Skip to content

Commit eeec848

Browse files
committed
Introduce "schema resource" and canonical URIs
This lets us talk more clearly about what an "$id" really is, as will be seen in the next commit. It also introduces the idea of a schema resource having a canonical URI, which is important for explaining why JSON Pointer fragments relative to parent base URIs (meaning that they "cross" a subschema "$id") should have undefined behavior.
1 parent 553489d commit eeec848

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

jsonschema-core.xml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
33
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
44
<!ENTITY RFC3986 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml">
5+
<!ENTITY RFC6596 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6596.xml">
56
<!ENTITY RFC6839 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6839.xml">
67
<!ENTITY RFC6901 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6901.xml">
78
<!ENTITY RFC7049 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7049.xml">
@@ -402,10 +403,22 @@
402403
additional keywords that are not part of a formal vocabulary.
403404
</t>
404405
</section>
405-
<section title="Root Schema and Subschemas" anchor="root">
406+
<section title="Root Schema and Subschemas and Resources" anchor="root">
407+
<t>
408+
A JSON Schema resource is a schema which is
409+
<xref target="RFC6596">canonically</xref> identified by an
410+
<xref target="RFC3986">absolute URI</xref>.
411+
</t>
412+
<t>
413+
As discussed in section
414+
<xref target="id-keyword" format="counter"></xref>, a JSON Schema document
415+
can contain multiple JSON Schema resources.
416+
</t>
406417
<t>
407418
The root schema is the schema that comprises the entire JSON document
408-
in question.
419+
in question. The root schema is always a schema resource, where the
420+
URI is determined as described in section
421+
<xref target="initial-base" format="counter"></xref>.
409422
</t>
410423
<t>
411424
Some keywords take schemas themselves, allowing JSON Schemas to be nested:
@@ -1455,7 +1468,7 @@
14551468
to other schemas by specifying their URI.
14561469
</t>
14571470

1458-
<section title="Initial Base URI">
1471+
<section title="Initial Base URI" anchor="initial-base">
14591472
<t>
14601473
<xref target="RFC3986">RFC3986 Section 5.1</xref> defines how to determine the
14611474
default base URI of a document.
@@ -1466,8 +1479,8 @@
14661479
situation identifiable by a URI of any known scheme.
14671480
</t>
14681481
<t>
1469-
If a schema document defines no explicit base URI with "$id" (embedded in content),
1470-
the base URI is that determined per
1482+
If a schema document defines no explicit base URI with "$id"
1483+
(embedded in content), the base URI is that determined per
14711484
<xref target="RFC3986">RFC 3986 section 5</xref>.
14721485
</t>
14731486
<t>
@@ -1476,6 +1489,11 @@
14761489
<xref target="RFC3986"> RFC 3986 Section 5.1.4</xref>. It is RECOMMENDED
14771490
that implementations document any default base URI that they assume.
14781491
</t>
1492+
<t>
1493+
Unless the "$id" keyword described in the next section is present in the
1494+
root schema, this base URI SHOULD be considered the canonical URI of the
1495+
schema document's root schema resource.
1496+
</t>
14791497
</section>
14801498

14811499
<section title='The "$id" Keyword' anchor="id-keyword">
@@ -3349,6 +3367,7 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
33493367
</references>
33503368

33513369
<references title="Informative References">
3370+
&RFC6596;
33523371
&RFC7049;
33533372
&RFC7231;
33543373
&RFC8288;

0 commit comments

Comments
 (0)