From d1323f521f60bd98181de3868adc4c544ee4f539 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Tue, 14 Feb 2017 12:17:47 -0800 Subject: [PATCH] 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. --- jsonschema-hyperschema.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/jsonschema-hyperschema.xml b/jsonschema-hyperschema.xml index 12598195..41c7638a 100644 --- a/jsonschema-hyperschema.xml +++ b/jsonschema-hyperschema.xml @@ -185,6 +185,27 @@ The base-64 data has been abbreviated for readability. +
+ + Hyper-schemas MUST NOT be applied to an instance if the instance fails + to validate against the validation keywords within or containing the hyper-schema. + Hyper-schema keywords in branches of an "anyOf" or "oneOf" that do not + validate, or in a "dependencies" subschema that is not relevant + to the instance, MUST be ignored. + + + Hyper-schema keywords in a subschema contained within + a "not", at any depth, including any number of intervening + additional "not" subschemas, MUST be ignored. + + + If the subschema for a "contains" keyword contains hyper-schema + keywords they MUST be applied to all array elements that validate + against the schema. While finding a single validating element + is sufficient to determine the validation outcome, when hyper-schema + keywords are present, the subschema MUST be evaluated against all array elements. + +