Skip to content

Commit 5f2fbb7

Browse files
authored
Merge pull request #609 from handrews/referenced
Explain referenced/referring schemas
2 parents 559e095 + 7e40945 commit 5f2fbb7

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

570603
</section>
@@ -920,7 +953,7 @@
920953
</section>
921954
</section>
922955

923-
<section title='Schema References With "$ref"'>
956+
<section title='Schema References With "$ref"' anchor="ref">
924957
<t>
925958
The "$ref" keyword is used to reference a schema, and provides the ability to
926959
validate recursive structures through self-reference.

0 commit comments

Comments
 (0)