Skip to content

Commit c99fb84

Browse files
authored
Merge pull request #1272 from handrews/dup-ids
Consolidate and clarify language around duplicate IRIs
2 parents 1de426c + 853c82b commit c99fb84

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

Diff for: jsonschema-core.xml

+18-10
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,10 @@
13991399
<xref target="RFC3986">RFC 3986 section 5.1.2</xref> regarding
14001400
encapsulating entities, if an "$id" in a subschema is a relative
14011401
IRI-reference, the base IRI for resolving that reference is the IRI of
1402-
the parent schema resource.
1402+
the parent schema resource. Note that an "$id" consisting of an empty IRI or
1403+
of the empty fragment only will result in the embedded resource having
1404+
the same IRI as the encapsulating resource, which SHOULD be considered
1405+
an error per section <xref target="duplicate-iris" format="counter"></xref>.
14031406
</t>
14041407
<t>
14051408
If no parent schema object explicitly identifies itself as a resource
@@ -1463,11 +1466,21 @@
14631466
fragment "#foo" when used in a IRI. See below for full examples.
14641467
</cref>
14651468
</t>
1469+
</section>
1470+
1471+
<section title="Duplicate schema identifiers" anchor="duplicate-iris">
1472+
<t>
1473+
A schema MAY (and likely will) have multiple IRIs, but there is no way
1474+
for an IRI to identify more than one schema. When multiple schemas
1475+
attempt to identify as the same IRI through the use of "$id", "$anchor",
1476+
"$dynamicAnchor", or any other mechanism, implementations SHOULD raise
1477+
an error condition. Otherwise the result is undefined, and even if
1478+
documented will not be interoperable.
1479+
</t>
14661480
<t>
1467-
The effect of specifying the same fragment name multiple times within
1468-
the same resource, using any combination of "$anchor" and/or
1469-
"$dynamicAnchor", is undefined. Implementations MAY
1470-
raise an error if such usage is detected.
1481+
Note that due to the semantics of JSON Pointer fragments, schema IRIs
1482+
that differ only by the presence or absence of an empty fragment MUST
1483+
be considered duplicates.
14711484
</t>
14721485
</section>
14731486

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

16881696
<section title="Detecting a Meta-Schema">

0 commit comments

Comments
 (0)