Skip to content

Commit cf618cd

Browse files
committed
Disallow fragments in "$id"
1 parent d59bda8 commit cf618cd

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
@@ -1362,31 +1362,10 @@
13621362
If present, the value for this keyword MUST be a string, and MUST represent a
13631363
valid <xref target="RFC3987">IRI-reference</xref>. This IRI-reference
13641364
SHOULD be normalized, and MUST resolve to an
1365-
<xref target="RFC3987">absolute-IRI</xref> (without a fragment),
1366-
or to a IRI with an empty fragment.
1365+
<xref target="RFC3987">absolute-IRI</xref> (without a fragment).
13671366
</t>
13681367
<t>
1369-
The empty fragment form is NOT RECOMMENDED and is retained only
1370-
for backwards compatibility, and because the
1371-
application/schema+json media type defines that a IRI with an
1372-
empty fragment identifies the same resource as the same IRI
1373-
with the fragment removed. However, since this equivalence is not
1374-
part of the <xref target="RFC3986">RFC 3986 normalization process</xref>,
1375-
implementers and schema authors cannot rely on generic IRI libraries
1376-
understanding it.
1377-
</t>
1378-
<t>
1379-
Therefore, "$id" MUST NOT contain a non-empty fragment, and SHOULD NOT
1380-
contain an empty fragment. The absolute-IRI form MUST be considered
1381-
the canonical IRI, regardless of the presence or absence of an empty fragment.
1382-
<cref>
1383-
An empty fragment is currently allowed because older meta-schemas have
1384-
an empty fragment in their $id (or previously, id).
1385-
A future draft may outright forbid even empty fragments in "$id".
1386-
</cref>
1387-
</t>
1388-
<t>
1389-
The absolute-IRI also serves as the base IRI for relative IRI-references
1368+
The resulting absolute-IRI serves as the base IRI for relative IRI-references
13901369
in keywords within the schema resource, in accordance with
13911370
<xref target="RFC3987">RFC 3987 section 6.5</xref> and
13921371
<xref target="RFC3986">RFC 3986 section 5.1.1</xref> regarding base IRIs
@@ -1477,11 +1456,6 @@
14771456
an error condition. Otherwise the result is undefined, and even if
14781457
documented will not be interoperable.
14791458
</t>
1480-
<t>
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.
1484-
</t>
14851459
</section>
14861460

14871461
<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)