Repository navigation
Conversation
Roman3349
force-pushed
the
fix/ref-identifier-resolution
branch
from
October 17, 2026 11:23
72afb14 to
68b1eb0
Compare
…aft 2019-09
A $ref whose fragment is a plain name rather than a JSON pointer could not
be resolved: fragment-only ids (draft-04 to draft-07) and $anchor (draft
2019-09) were never registered, and the fragment was rewritten to a JSON
pointer ("#foo" became "#/foo"). The Draft-06/07/2019-09 constraints
swallowed the resulting exception, so such a $ref passed silently, while
Draft-04 threw.
- SchemaStorage registers anchors and resolves a plain-name fragment
against them. A fragment-only id no longer changes the base uri.
- From Draft 2019-09 on, a $ref is resolved against the $id next to it,
as the dialect declared by $schema says. Up to draft-07 the sibling
$id stays ignored.
- UriResolver resolves a fragment-only reference against the base without
its fragment, and no longer takes a base without an authority (urn:)
for a local file path.
Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
Roman3349
force-pushed
the
fix/ref-identifier-resolution
branch
from
October 18, 2026 00:37
68b1eb0 to
c357098
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A
$refwhose fragment is a plain name (an anchor) rather than a JSON pointer could not be resolved. Fragment-only ids ("id": "#foo"/"$id": "#foo"in Draft-04 to Draft-07) and$anchor(Draft 2019-09) were never registered. On top of that,expandRefs()rewrote the fragment into a JSON pointer, so#foobecame#/foo. The Draft-06/07/2019-09RefConstraints swallow the resulting exception, so such a$refpassed silently (any instance validated), while Draft-04 threwUnresolvableJsonPointerException.URN base URIs were broken as well.
UriResolver::resolve()tookurn:uuid:…for a local file path and prefixed it withfile://<cwd>/, andgenerate()would have producedurn://uuid:…anyway.Changes:
SchemaStorageUnresolvableJsonPointerException.$refis resolved against the$idnext to it. The dialect is taken from$schemaand inherited by subschemas. Up to Draft-07 the sibling$idstays ignored. Without$schemathe previous behavior is kept.UriResolverurn:) is no longer treated as a local file path. A single-letter scheme still is, to keep Windows drive paths (C:\…) working.Related Issue
Related to #916 (an unresolvable
$refpassing silently). Most of the cases in that issue were refs this library could not resolve; they now resolve. This PR does not change how a genuinely unresolvable$refis reported; that is what #944 addresses.Type of Change
Checklist
Additional Notes