davishmcclurg / json_schemer

JSON Schema validator. Supports drafts 4, 6, 7, 2019-09, 2020-12, OpenAPI 3.0, and OpenAPI 3.1.
MIT License
399 stars 64 forks source link

Use default base URI for exclusive refs #147

Closed davishmcclurg closed 11 months ago

davishmcclurg commented 11 months ago

In drafts 7 and earlier, all keywords except definitions are ignored when $ref is present. This includes $id, which means refs are resolved using the schema's inherited base URI (default or parent). Currently, when $id is present, the inherited base URI isn't being registered as a ref resolution resource (with ID_KEYWORD_CLASS.new), which causes JSON pointer ref resolution to fail. The fix here is to add the exclusive ref case for the ID_KEYWORD_CLASS.new call.

The rest of the changes are from if/else cleanup.

Closes: https://github.com/davishmcclurg/json_schemer/issues/146