Skip to content

Consolidate and clarify language around duplicate IRIs #1272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,10 @@
<xref target="RFC3986">RFC 3986 section 5.1.2</xref> regarding
encapsulating entities, if an "$id" in a subschema is a relative
IRI-reference, the base IRI for resolving that reference is the IRI of
the parent schema resource.
the parent schema resource. Note that an "$id" consisting of an empty IRI or
of the empty fragment only will result in the embedded resource having
the same IRI as the encapsulating resource, which SHOULD be considered
an error per section <xref target="duplicate-iris" format="counter"></xref>.
</t>
<t>
If no parent schema object explicitly identifies itself as a resource
Expand Down Expand Up @@ -1456,11 +1459,21 @@
fragment "#foo" when used in a IRI. See below for full examples.
</cref>
</t>
</section>

<section title="Duplicate schema identifiers" anchor="duplicate-iris">
<t>
A schema MAY (and likely will) have multiple IRIs, but there is no way
for an IRI to identify more than one schema. When multiple schemas
attempt to identify as the same IRI through the use of "$id", "$anchor",
"$dynamicAnchor", or any other mechanism, implementations SHOULD raise
an error condition. Otherwise the result is undefined, and even if
documented will not be interoperable.
</t>
<t>
The effect of specifying the same fragment name multiple times within
the same resource, using any combination of "$anchor" and/or
"$dynamicAnchor", is undefined. Implementations MAY
raise an error if such usage is detected.
Note that due to the semantics of JSON Pointer fragments, schema IRIs
that differ only by the presence or absence of an empty fragment MUST
be considered duplicates.
</t>
</section>

Expand Down Expand Up @@ -1671,11 +1684,6 @@
be noted within a schema document as it is processed, producing associations
as shown in appendix <xref target="idExamples" format="counter"></xref>.
</t>
<t>
A schema MAY (and likely will) have multiple IRIs, but there is no way for a
IRI to identify more than one schema. When multiple schemas try to identify
as the same IRI, validators SHOULD raise an error condition.
</t>
</section>

<section title="Detecting a Meta-Schema">
Expand Down