Skip to content

Commit 7a6c26c

Browse files
authored
Merge pull request #551 from awwright/master
Core: Improve language for schema references section
2 parents 0b1a062 + d9abd15 commit 7a6c26c

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

jsonschema-core.xml

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,11 @@
528528
</section>
529529

530530
<section title="Base URI and Dereferencing">
531+
<t>
532+
To differentiate between schemas in a vast ecosystem, schemas are
533+
identified by <xref target="RFC3986">URI</xref>, and can embed references to other schemas by specifying their URI.
534+
</t>
535+
531536
<section title="Initial Base URI">
532537
<t>
533538
<xref target="RFC3986">RFC3986 Section 5.1</xref> defines how to determine the
@@ -557,8 +562,8 @@
557562
<section title="Identifying the root schema">
558563
<t>
559564
The root schema of a JSON Schema document SHOULD contain an "$id" keyword with
560-
a URI (containing a scheme). This URI SHOULD either not have a fragment, or
561-
have one that is an empty string.
565+
an <xref target="RFC3986">absolute-URI</xref> (containing a scheme, but no fragment),
566+
or this absolute URI but with an empty fragment.
562567
<!-- All of the standard meta-schemas use an empty fragment in their id/$id values. -->
563568
</t>
564569
</section>
@@ -583,18 +588,16 @@
583588
without requiring JSON Pointer references to be updated.
584589
</t>
585590
<t>
586-
To name subschemas in a JSON Schema document,
587-
subschemas can use "$id" to give themselves a document-local identifier.
588-
This is done by setting "$id" to a URI reference consisting
589-
only of a plain name fragment (not a JSON Pointer fragment).
590-
The fragment identifier MUST begin with a letter ([A-Za-z]), followed by
591-
any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons
592-
(":"), or periods (".").
591+
To specify such a subschema identifier,
592+
the "$id" keyword is set to a URI reference with a plain name fragment (not a JSON Pointer fragment).
593+
This value MUST begin with the number sign that specifies a fragment ("#"),
594+
then a letter ([A-Za-z]),
595+
followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
596+
colons (":"), or periods (".").
593597
</t>
594598
<t>
595-
The effect of defining a fragment-only "$id" URI reference that neither
596-
matches the above requirements nor is a valid JSON pointer
597-
is not defined.
599+
The effect of using a fragment in "$id" that isn't blank or doesn't follow the
600+
plain name syntax is undefined.
598601
<cref>
599602
How should an "$id" URI reference containing a fragment with other components
600603
be interpreted? There are two cases: when the other components match
@@ -711,11 +714,14 @@
711714
</t>
712715
<section title="Loading a referenced schema">
713716
<t>
714-
To differentiate schemas between each other in a vast ecosystem, schemas are
715-
identified by URI. As specified above, this does not necessarily mean
716-
anything is downloaded, but instead JSON Schema implementations SHOULD
717-
already understand the schemas they will be using, including the URIs that
718-
identify them.
717+
The use of URIs to identify remote schemas does not necessarily mean anything is downloaded,
718+
but instead JSON Schema implementations SHOULD understand ahead of time which schemas they will be using,
719+
and the URIs that identify them.
720+
</t>
721+
<t>
722+
When schemas are downloaded,
723+
for example by a generic user-agent that doesn't know until runtime which schemas to download,
724+
see <xref target="hypermedia">Usage for Hypermedia</xref>.
719725
</t>
720726
<t>
721727
Implementations SHOULD be able to associate arbitrary URIs with an arbitrary
@@ -728,7 +734,7 @@
728734
<t>
729735
A schema MAY (and likely will) have multiple URIs, but there is no way for a
730736
URI to identify more than one schema. When multiple schemas try to identify
731-
with the same URI, validators SHOULD raise an error condition.
737+
as the same URI, validators SHOULD raise an error condition.
732738
</t>
733739
</section>
734740
<section title="Dereferencing">
@@ -829,7 +835,7 @@
829835
</t>
830836
</section>
831837

832-
<section title="Usage for Hypermedia">
838+
<section title="Usage for Hypermedia" anchor="hypermedia">
833839

834840
<t>
835841
JSON has been adopted widely by HTTP servers for automated APIs and robots. This
@@ -974,12 +980,12 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
974980
<t>
975981
Instances and schemas are both frequently written by untrusted third parties, to be
976982
deployed on public Internet servers.
977-
Validators should take care that the parsing of schemas doesn't consume excessive
983+
Validators should take care that the parsing and validating against schemas doesn't consume excessive
978984
system resources.
979985
Validators MUST NOT fall into an infinite loop.
980986
</t>
981987
<t>
982-
Servers need to take care that malicious parties can't change the functionality of
988+
Servers MUST ensure that malicious parties can't change the functionality of
983989
existing schemas by uploading a schema with an pre-existing or very similar "$id".
984990
</t>
985991
<t>

0 commit comments

Comments
 (0)