Skip to content

Commit 22086e5

Browse files
committed
Remove "Internal Referencing" and rework example
We know from feedback that the "internal referencing" concept and in particular the "same document" wording is confusing and for some people misleading. Remove the term and focus the wording on normal RFC 3986 URI reference resolution. Cover the same logical ground as "internal referencing" by discussing whether and how the implementation knows of the identified schema, using the same general ideas as covered in the previous section on loading (or not loading) referenced schemas.
1 parent 8ca3eca commit 22086e5

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

jsonschema-core.xml

+26-12
Original file line numberDiff line numberDiff line change
@@ -731,19 +731,19 @@
731731
with the same URI, validators SHOULD raise an error condition.
732732
</t>
733733
</section>
734-
</section>
735-
736-
<section title="Dereferencing">
737-
<section title="Internal References">
734+
<section title="Dereferencing">
738735
<t>
739736
Schemas can be identified by any URI that has been given to them, including
740-
a JSON Pointer or their URI given directly by "$id".
737+
a JSON Pointer or their URI given directly by "$id". In all cases,
738+
dereferencing a "$ref" reference involves first resolving its value as a
739+
URI reference against the current base URI per
740+
<xref target="RFC3986">RFC 3985</xref>.
741741
</t>
742742
<t>
743-
Tools SHOULD take note of the URIs that schemas, including subschemas,
744-
provide for themselves using "$id". This is known as "Internal referencing".
743+
If the resulting URI identifies a schema within the current document, or
744+
within another schema document that has been made available to the implementation,
745+
then that schema SHOULD be used automatically.
745746
</t>
746-
747747
<t>
748748
For example, consider this schema:
749749
</t>
@@ -760,7 +760,8 @@
760760
"definitions": {
761761
"single": {
762762
"$id": "#item",
763-
"type": "integer"
763+
"type": "object",
764+
"additionalProperties": { "$ref": "other.json" }
764765
}
765766
}
766767
}
@@ -775,9 +776,22 @@
775776
<t>
776777
When an implementation then looks inside the &lt;#/items&gt; schema, it
777778
encounters the &lt;#item&gt; reference, and resolves this to
778-
&lt;http://example.net/root.json#item&gt; which is understood as the schema
779-
defined elsewhere in the same document without needing to
780-
resolve the fragment against the base URI.
779+
&lt;http://example.net/root.json#item&gt;, which it has seen defined in
780+
this same document and can therefore use automatically.
781+
</t>
782+
<t>
783+
When an implementation encounters the reference to "other.json", it resolves
784+
this to &lt;http://example.net/other.json&gt;, which is not defined in this
785+
document. If a schema with that identifier has otherwise been supplied to
786+
the implementation, it can also be used automatically.
787+
<cref>
788+
What should implementations do when the referenced schema is not known?
789+
Are there circumstances in which automatic network dereferencing is
790+
allowed? A same origin policy? A user-configurable option? In the
791+
case of an evolving API described by Hyper-Schema, it is expected that
792+
new schemas will be added to the system dynamically, so placing an
793+
absolute requirement of pre-loading schema documents is not feasible.
794+
</cref>
781795
</t>
782796
</section>
783797
</section>

0 commit comments

Comments
 (0)