Skip to content

Commit a6af98a

Browse files
committed
Explain refereced/referring schemas
For several upcoming features, we need better language to talk about the schemas on either side of a "$ref" or similar linking keyword. In particular, annotation collection interacts with references, and calling referenced schemas "subschemas" is confusing and technically inaccurate.
1 parent bc2a042 commit a6af98a

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

jsonschema-core.xml

+40-7
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,19 @@
195195
<xref target="schema-document">schema document</xref> begins by applying
196196
the <xref target="root">root schema</xref> to the complete instance
197197
document. From there, keywords known as applicators are used to determine
198-
which additional subschemas are applied. Subschema may be applied in-place
199-
to the current location, or to a child location. The subschemas may be all
200-
or part of the keyword's value, or the keyword's value may identify one
201-
or more schemas in a way defined by the keyword.
198+
which additional schemas are applied. Such schemas may be applied in-place
199+
to the current location, or to a child location.
202200
</t>
203201
<t>
204-
Applicator keywords also define how subschema boolean
205-
<xref target="assertions">assertion</xref>
202+
The schemas to be applied may be present as subschemas comprising all or
203+
part of the keyword's value. Alternatively, an applicator may refer to
204+
a schema elsewhere in the same schema document, or in a different one.
205+
The mechanism for identifying such referred schemas is defined by the
206+
keyword.
207+
</t>
208+
<t>
209+
Applicator keywords also define how subschema or referred schema
210+
boolean <xref target="assertions">assertion</xref>
206211
results are modified and/or combined to produce the boolean result
207212
of the applicator. Applicators may apply any boolean logic operation
208213
to the assertion results of subschemas, but MUST NOT introduce new
@@ -562,6 +567,34 @@
562567
As with the root schema, a subschema is either an object or a boolean.
563568
</t>
564569
</section>
570+
<section title="Referred and Referring Schemas" anchor="referred">
571+
<t>
572+
As noted in <xref target="applicators" />, an applicator keyword may
573+
refer to a schema to be applied, rather than including it as a
574+
subschema in the applicator's value. In such situations, the
575+
schema being applied is known as the referred schema, while
576+
the schema containing the applicator keyword is the referring schema.
577+
</t>
578+
<t>
579+
While root schemas and subschemas are static concepts based on a
580+
schema's position within a schema document, referred and referring
581+
schemas are dynamic. Different pairs of schemas may find themselves
582+
in various referred and referring arrangements during the evaluation
583+
of an instance against a schema.
584+
</t>
585+
<t>
586+
For some by-reference applicators, such as
587+
<xref target="ref">"$ref"</xref>, the referred schema can be determined
588+
by static analysis of the schema document. Others may take evaluation
589+
context into account, and only be resolvable in the process of evaluating
590+
with an instance.
591+
<cref>
592+
Assuming some form of dynamic reference keyword is introduced
593+
related to GitHub issue #558, this section will be updated
594+
to make a concrete reference to that keyword for clarification.
595+
</cref>
596+
</t>
597+
</section>
565598
</section>
566599

567600
</section>
@@ -884,7 +917,7 @@
884917
</section>
885918
</section>
886919

887-
<section title='Schema References With "$ref"'>
920+
<section title='Schema References With "$ref"' anchor="ref">
888921
<t>
889922
The "$ref" keyword is used to reference a schema, and provides the ability to
890923
validate recursive structures through self-reference.

0 commit comments

Comments
 (0)