Skip to content

Commit

Permalink
Merge pull request #1272 from handrews/dup-ids
Browse files Browse the repository at this point in the history
Consolidate and clarify language around duplicate IRIs
  • Loading branch information
handrews authored Sep 6, 2022
2 parents 1de426c + 853c82b commit c99fb84
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,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 @@ -1463,11 +1466,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 @@ -1678,11 +1691,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

0 comments on commit c99fb84

Please sign in to comment.