Skip to content

Commit 92d0632

Browse files
committed
Provide guidance on hyperschema and validation
It's been commonly assumed that hyper-schema keywords apply only when validation is successful. Be explicit about this, and resolve ambiguous situations. Most notably, remove any burden on implementations to figure out what to do with situations such as: {"not": {"not": {"links": [...]}}} where the schema containing links technically must validate against the instance, but any less trivial nesting of "not"s (including such situations as a "not" inside of a "oneOf" branch that fails validation while the overall "oneOf" succeeds) rapidly becomes extremely difficult to reason about.
1 parent c98a9d4 commit 92d0632

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

jsonschema-hyperschema.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,27 @@
185185
<postamble>The base-64 data has been abbreviated for readability.</postamble>
186186
</figure>
187187

188+
<section title="Interaction with validation">
189+
<t>
190+
Hyper-schemas MUST NOT be applied to an instance if the instance fails
191+
to validate against the validation keywords within or containing the hyper-schema.
192+
Hyper-schema keywords in branches of an "anyOf" or "oneOf" that do not
193+
validate, or in a "dependencies" subschema that is not relevant
194+
to the instance, MUST be ignored.
195+
</t>
196+
<t>
197+
Hyper-schema keywords in a subschema contained within
198+
a "not", at any depth, including any number of intervening
199+
additional "not" subschemas, MUST be ignored.
200+
</t>
201+
<t>
202+
If the subschema for a "contains" keyword contains hyper-schema
203+
keywords they MUST be applied to all array elements that validate
204+
against the schema. While finding a single validating element
205+
is sufficient to determine the validation outcome, when hyper-schema
206+
keywords are present, the subschema MUST be evaluated against all array elements.
207+
</t>
208+
</section>
188209
</section>
189210

190211
<section title="Meta-schema">

0 commit comments

Comments
 (0)