Skip to content

Commit c77b64a

Browse files
committed
Core: Hint at how a validator API should be implemented
1 parent f52e75c commit c77b64a

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

jsonschema-core.xml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,11 @@
351351
specified in [RFC3986].
352352
</t>
353353
<t>
354-
The value for this keyword MUST be a string, and MUST be a valid <xref target="RFC3986">URI-reference</xref>.
355-
This URI SHOULD be normalized, and SHOULD NOT be an empty fragment (#) or the empty string.
354+
The value for this keyword MUST be a string, and MUST represent a valid <xref target="RFC3986">URI-reference</xref>.
355+
This URI SHOULD be normalized, and SHOULD NOT be an empty fragment &lt;#&gt; or an empty string &gt;&lt;.
356356
</t>
357357
<t>
358-
The outermost schema of a JSON Schema document SHOULD be an absolute-URI (containing a scheme, but no fragment).
358+
The root schema of a JSON Schema document SHOULD specify an absolute-URI "id" (containing a scheme, but no fragment).
359359
</t>
360360
<t>
361361
To identify a particular subschema in a document without needing a JSON Pointer,
@@ -404,16 +404,13 @@
404404
<t hangText="#/definitions/schema3">urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f</t>
405405
</list>
406406
</t>
407-
<section title="Methods for dereferencing">
407+
<section title="Inline references">
408408
<t>
409409
Schemas can be identified by any URI that has been given to them, including a JSON Pointer or
410410
their URI given directly by "id".
411411
</t>
412412
<t>
413-
When resolving a URI to obtain a schema, tools MUST support the lookup of documents based on this URI, and the use of JSON Pointer fragments to locate particular locations within a schema document.
414-
</t>
415-
<t>
416-
Tools MAY also take note of the URIs schemas provide for themselves using "id", and use these values for schema dereferencing as well.
413+
Tools SHOULD take note of the URIs that schemas, including subschemas, provide for themselves using "id".
417414
This is known as "inline referencing".
418415
</t>
419416

@@ -441,12 +438,12 @@
441438
</artwork>
442439
</figure>
443440
<t>
444-
When an implementation encounters the "schema1" schema, it resolves the "id" URI reference
441+
When an implementation encounters the &lt;schema1&gt; schema, it resolves the "id" URI reference
445442
against the current base URI, resolving to &lt;http://example.net/schema1&gt;.
446443
</t>
447444
<t>
448-
When an implementation then looks inside the "schema2" schema, it encounters the "schema1" reference,
449-
and resolves this the URI &lt;http://example.net/schema1&gt; which is understood as a schema defined elsewhere in the document.
445+
When an implementation then looks inside the &lt;schema2&gt; schema, it encounters the &lt;schema1&gt; reference,
446+
and resolves this the URI &lt;http://example.net/schema1&gt; which is understood as the schema defined elsewhere in the same document.
450447
</t>
451448
<figure>
452449
<preamble>
@@ -468,6 +465,22 @@
468465
</artwork>
469466
</figure>
470467
</section>
468+
<section title="External references">
469+
<t>
470+
To differentiate schemas between each other in a vast ecosystem, schemas are identified by URI.
471+
As specified above, this does not necessarially mean anything is downloaded, but instead JSON Schema
472+
implementations SHOULD provide ways to import a schema so that other schemas can reference it.
473+
</t>
474+
<t>
475+
Implementations SHOULD be able to associate arbritrary URIs with an arbritrary schema and/or
476+
automatically associate a schema's "id"-given URI, depending on the trust that the the validator
477+
has in the schema.
478+
</t>
479+
<t>
480+
A schema may have multiple URIs, but a URI must identify not more than one schema.
481+
Validators that try to have multiple schemas associated to the same URI SHOULD raise an error condition.
482+
</t>
483+
</section>
471484
</section>
472485
</section>
473486

0 commit comments

Comments
 (0)