Skip to content

Commit 6ec6862

Browse files
authored
Merge pull request #1291 from handrews/id-no-frag
Disallow fragments in "$id"
2 parents 9f92f88 + cf618cd commit 6ec6862

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

jsonschema-core.xml

+2-28
Original file line numberDiff line numberDiff line change
@@ -1376,31 +1376,10 @@
13761376
If present, the value for this keyword MUST be a string, and MUST represent a
13771377
valid <xref target="RFC3987">IRI-reference</xref>. This IRI-reference
13781378
SHOULD be normalized, and MUST resolve to an
1379-
<xref target="RFC3987">absolute-IRI</xref> (without a fragment),
1380-
or to a IRI with an empty fragment.
1379+
<xref target="RFC3987">absolute-IRI</xref> (without a fragment).
13811380
</t>
13821381
<t>
1383-
The empty fragment form is NOT RECOMMENDED and is retained only
1384-
for backwards compatibility, and because the
1385-
application/schema+json media type defines that a IRI with an
1386-
empty fragment identifies the same resource as the same IRI
1387-
with the fragment removed. However, since this equivalence is not
1388-
part of the <xref target="RFC3986">RFC 3986 normalization process</xref>,
1389-
implementers and schema authors cannot rely on generic IRI libraries
1390-
understanding it.
1391-
</t>
1392-
<t>
1393-
Therefore, "$id" MUST NOT contain a non-empty fragment, and SHOULD NOT
1394-
contain an empty fragment. The absolute-IRI form MUST be considered
1395-
the canonical IRI, regardless of the presence or absence of an empty fragment.
1396-
<cref>
1397-
An empty fragment is currently allowed because older meta-schemas have
1398-
an empty fragment in their $id (or previously, id).
1399-
A future draft may outright forbid even empty fragments in "$id".
1400-
</cref>
1401-
</t>
1402-
<t>
1403-
The absolute-IRI also serves as the base IRI for relative IRI-references
1382+
The resulting absolute-IRI serves as the base IRI for relative IRI-references
14041383
in keywords within the schema resource, in accordance with
14051384
<xref target="RFC3987">RFC 3987 section 6.5</xref> and
14061385
<xref target="RFC3986">RFC 3986 section 5.1.1</xref> regarding base IRIs
@@ -1489,11 +1468,6 @@
14891468
an error condition. Otherwise the result is undefined, and even if
14901469
documented will not be interoperable.
14911470
</t>
1492-
<t>
1493-
Note that due to the semantics of JSON Pointer fragments, schema IRIs
1494-
that differ only by the presence or absence of an empty fragment MUST
1495-
be considered duplicates.
1496-
</t>
14971471
</section>
14981472

14991473
<section title="Schema References" anchor="references">

meta/core.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"properties": {
1212
"$id": {
1313
"$ref": "#/$defs/iriReferenceString",
14-
"$comment": "Non-empty fragments not allowed.",
15-
"pattern": "^[^#]*#?$"
14+
"$comment": "Fragments not allowed.",
15+
"pattern": "^[^#]*$"
1616
},
1717
"$schema": { "$ref": "#/$defs/iriString" },
1818
"$ref": { "$ref": "#/$defs/iriReferenceString" },

0 commit comments

Comments
 (0)