From 488ad8fcc7480a3c79b7149e3e7eb0623d8c4357 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Sun, 23 Sep 2018 16:23:55 -0700 Subject: [PATCH 1/2] Add unevaluatedProperties --- jsonschema-core.xml | 61 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 913b886e..e52695b9 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -1341,7 +1341,12 @@ "additionalProperties", whose behavior is defined in terms of - "properties" and "patternProperties"; and + "properties" and "patternProperties" + + + "unevaluatedProperties", whose behavior is defined in terms of + annotations from "properties", "patternProperties", + "additionalProperties" and itself. "additionalItems", whose behavior is defined in terms of "items". @@ -1350,7 +1355,7 @@ -
+
These keywords apply subschemas to the same location in the instance as the parent schema is being applied. They allow combining @@ -1687,7 +1692,7 @@ an empty schema. - Implementation MAY choose to implement or optimize this keyword + Implementations MAY choose to implement or optimize this keyword in another way that produces the same effect, such as by directly checking the names in "properties" and the patterns in "patternProperties" against the instance property set. @@ -1695,6 +1700,56 @@
+
+ + The value of "unevaluatedProperties" MUST be a valid JSON Schema. + + + The behavior of this keyword depends on the annotation results of + adjacent keywords that apply to the instance location being validated. + Specifically, the annotations from "properties", "patternProperties", + and "additionalProperties", which can come from those keywords when + they are adjacent to the "unvevaluatedProperties" keyword. Those + three annotations, as well as "unevaluatedProperties", can also + result from any and all adjacent + in-place applicator keywords. + This includes but is not limited to the in-place applicators + defined in this document. + + + Validation with "unevaluatedProperties" applies only to the child + values of instance names that do not appear in the "properties", + "patternProperties", "additionalProperties", or + "unevaluatedProperties" annotation results that apply to the + instance location being validated. + + + For all such properties, validation succeeds if the child instance + validates against the "unevaluatedProperties" schema. + + + This means that "properties", "patternProperties", "additionalProperties", + and all in-place applicators MUST be evaluated before this keyword can + be evaluated. Authors of extension keywords MUST NOT define an in-place + applicator that would need to be evaluated before this keyword. + + + The annotation result of this keyword is the set of instance + property names validated by this keyword's subschema. + Annotation results for "unevaluatedProperties" keywords from + multiple schemas applied to the same instance location are combined + by taking the union of the sets. + + + Omitting this keyword has the same assertion behavior as + an empty schema. + + + Implementations that do not collect annotations MUST raise an error + upon encountering this keyword. + +
+
The value of "propertyNames" MUST be a valid JSON Schema. From a71aa68ac87885f8fabeaf9b7200d53e92d7a149 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Sun, 23 Sep 2018 16:45:49 -0700 Subject: [PATCH 2/2] Add unevaluatedItems --- jsonschema-core.xml | 64 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index e52695b9..7a29a0c7 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -1346,10 +1346,14 @@ "unevaluatedProperties", whose behavior is defined in terms of annotations from "properties", "patternProperties", - "additionalProperties" and itself. + "additionalProperties" and itself - "additionalItems", whose behavior is defined in terms of "items". + "additionalItems", whose behavior is defined in terms of "items" + + + "unevaluatedItems", whose behavior is defined in terms of annotations + from "items", "additionalItems" and itself @@ -1593,6 +1597,60 @@
+
+ + The value of "unevaluatedItems" MUST be a valid JSON Schema. + + + The behavior of this keyword depends on the annotation results of + adjacent keywords that apply to the instance location being validated. + Specifically, the annotations from "items" and "additionalItems", + which can come from those keywords when they are adjacent to the + "unevaluatedItems" keyword. Those two annotations, as well as + "unevaluatedItems", can also result from any and all adjacent + in-place applicator keywords. + This includes but is not limited to the in-place applicators + defined in this document. + + + If an "items" annotation is present, and its annotation result + is a number, and no "additionalItems" or "unevaluatedItems" + annotation is present, then validation succeeds if every instance + element at an index greater than the "items" annotation validates + against "unevaluatedItems". + + + Otherwise, if any "items", "additionalItems", or "unevaluatedItems" + annotations are present with a value of boolean true, then + "unevaluatedItems" MUST be ignored. However, if none of these + annotations are present, "unevaluatedItems" MUST be applied to + all locations in the array. + + + This means that "items", "additionalItems", and all in-place applicators + MUST be evaluated before this keyword can be evaluated. Authors of + extension keywords MUST NOT define an in-place applicator that would need + to be evaluated before this keyword. + + + If the "unevaluatedItems" subschema is applied to any + positions within the instance array, it produces an + annotation result of boolean true, analogous to the + single schema behavior of "items". If any "unevaluatedItems" + keyword from any subschema applied to the same instance + location produces an annotation value of true, then + the combined result from these keywords is also true. + + + Omitting this keyword has the same assertion behavior as + an empty schema. + + + Implementations that do not collect annotations MUST raise an error + upon encountering this keyword. + +
+
The value of this keyword MUST be a valid JSON Schema. @@ -1709,7 +1767,7 @@ adjacent keywords that apply to the instance location being validated. Specifically, the annotations from "properties", "patternProperties", and "additionalProperties", which can come from those keywords when - they are adjacent to the "unvevaluatedProperties" keyword. Those + they are adjacent to the "unevaluatedProperties" keyword. Those three annotations, as well as "unevaluatedProperties", can also result from any and all adjacent in-place applicator keywords.