From 0667b893319edce413a5801ffd3ca1ba7a0303e0 Mon Sep 17 00:00:00 2001 From: Austin Wright Date: Fri, 27 Jan 2017 15:17:00 -0700 Subject: [PATCH 1/5] Various language improvements --- jsonschema-core.xml | 3 +- jsonschema-validation.xml | 137 +++++++++++++++++--------------------- 2 files changed, 62 insertions(+), 78 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index a1dccdab..aa478ec5 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -76,8 +76,7 @@ This specification defines JSON Schema core terminology and mechanisms, including pointing to another JSON Schema by reference, dereferencing a JSON Schema reference, - specifying the vocabulary being used, - and declaring the minimum functionality necessary for processing an instance against a schema. + and specifying the vocabulary being used. Other specifications define the vocabularies that perform assertions about validation, diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 0333e5ea..e9cd0c9a 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -98,11 +98,6 @@ object instances. It uses the term "children instances" to refer to array elements or object member values. - - This specification uses the term "property set" to refer to the set of an object's - member names; for instance, the property set of JSON Object { "a": 1, "b": 2 } is - [ "a", "b" ]. - Elements in an array value are said to be unique if no two elements of this array are equal. @@ -167,8 +162,8 @@
- Most validation keywords only limit the range of values within a certain primitive type. - When the primitive type of the instance is not of the type targeted by the keyword, the + Most validation keywords only exclude a range of values within a certain primitive type. + When the type of the instance is not of the type targeted by the keyword, the validation succeeds. @@ -222,8 +217,8 @@ For schema author convenience, there are some exceptions: - "additionalProperties", whose behavior is defined in terms of "properties" and "patternProperties"; - "additionalItems", whose behavior is defined in terms of "items"; and + "additionalProperties", whose behavior is defined in terms of "properties" and "patternProperties"; and + "additionalItems", whose behavior is defined in terms of "items".
@@ -241,7 +236,7 @@
- Validation keywords in a schema impose requirements for successfully validating an instance. + Validation keywords in a schema impose requirements for successful validation of an instance.
@@ -290,11 +285,8 @@
- The value of this keyword MUST be a non-negative integer. - The value of this keyword MUST be an integer. This integer MUST be - greater than, or equal to, 0. - + The value of this keyword MUST be a non-negative integer. A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. @@ -306,6 +298,9 @@
+ + The value of this keyword MUST be a non-negative integer. + A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. @@ -316,12 +311,7 @@ characters as defined by RFC 7159. - The value of this keyword MUST be an integer. This integer MUST be - greater than, or equal to, 0. - - - "minLength", if absent, may be considered as being present with integer - value 0. + A missing keyword has the same behavior as a value of 0.
@@ -364,9 +354,6 @@ The value of "additionalItems" MUST be a valid JSON Schema. - - If absent, it can be considered present with an empty schema. - This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. @@ -381,12 +368,14 @@ schema (possibly the default value of an empty schema) is applied to all elements. + + A missing keyword has the same behavior as an empty schema. +
- The value of this keyword MUST be an integer. This integer MUST be - greater than, or equal to, 0. + The value of this keyword MUST be a non-negative integer. An array instance is valid against "maxItems" if its size is @@ -396,16 +385,14 @@
- The value of this keyword MUST be an integer. This integer MUST be - greater than, or equal to, 0. + The value of this keyword MUST be a non-negative integer. An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. - If this keyword is not present, it may be considered present with a - value of 0. + A missing keyword has the same behavior as a value of 0.
@@ -419,8 +406,7 @@ successfully if all of its elements are unique.
- If not present, this keyword may be considered present with boolean - value false. + A missing keyword has the same behavior as a value of false.
@@ -437,8 +423,7 @@
- The value of this keyword MUST be an integer. This integer MUST be - greater than, or equal to, 0. + The value of this keyword MUST be a non-negative integer. An object instance is valid against "maxProperties" if its @@ -449,8 +434,7 @@
- The value of this keyword MUST be an integer. This integer MUST be - greater than, or equal to, 0. + The value of this keyword MUST be a non-negative integer. An object instance is valid against "minProperties" if its @@ -458,33 +442,28 @@ keyword. - If this keyword is not present, it may be considered present with a - value of 0. + A missing keyword has the same behavior as a value of 0.
- The value of this keyword MUST be an array. Elements of this array, - if any, MUST be strings, and MUST be unique. + The value of this keyword MUST be an array. + Elements of this array, if any, MUST be strings, and MUST be unique. - An object instance is valid against this keyword if its - property set contains all elements in this keyword's array value. + An object instance is valid against this keyword if every item in the array is + the name of a property in the instance. - If this keyword is not present, it may be considered present - as an empty array. + A missing keyword has the same behavior as an empty array.
- The value of "properties" MUST be an object. Each value of this object - MUST be a valid JSON Schema. - - - If absent, it can be considered the same as an empty schema. + The value of "properties" MUST be an object. + Each value of this object MUST be a valid JSON Schema. This keyword determines how child instances validate for objects, @@ -496,6 +475,9 @@ instance for that name successfully validates against the corresponding schema. + + A missing keyword has the same behavior as an empty object. +
@@ -505,9 +487,6 @@ ECMA 262 regular expression dialect. Each property value of this object MUST be a valid JSON Schema. - - If absent, it can be considered the same as an empty schema. - This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. @@ -520,16 +499,15 @@ the child instance for that name successfully validates against each schema that corresponds to a matching regular expression. + + A missing keyword has the same behavior as an empty object. +
The value of "additionalProperties" MUST be a valid JSON Schema. - - If "additionalProperties" is absent, it may be considered present with - an empty schema as a value. - This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. @@ -543,6 +521,9 @@ For all such properties, child validation succeeds if the child instance validates against the "additionalProperties" schema. + + A missing keyword has the same behavior as an empty schema. +
@@ -564,6 +545,9 @@ a property in the instance, each of the items in the dependency value must be a property that exists in the instance. + + A missing keyword has the same behavior as an empty object. +
@@ -575,6 +559,9 @@ validates against the provided schema. Note the property name that the schema is testing will always be a string. + + A missing keyword has the same behavior as an empty schema. +
@@ -582,14 +569,13 @@ The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique. - - - Elements in the array MAY be of any type, including null. - An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value. + + Elements in the array might be of any value, including null. +
@@ -619,8 +605,8 @@
- This keyword's value MUST be an array. This array MUST have at least one - element. + This keyword's value MUST be an array. + This array MUST have at least one element. Elements of the array MUST be objects. Each object MUST be a valid JSON @@ -634,12 +620,12 @@
- This keyword's value MUST be an array. This array MUST have at least one - element. + This keyword's value MUST be an array. + This array MUST have at least one element. - Elements of the array MUST be objects. Each object MUST be a valid JSON - Schema. + Elements of the array MUST be objects. + Each object MUST be a valid JSON Schema. An instance validates successfully against this keyword if it validates @@ -649,12 +635,12 @@
- This keyword's value MUST be an array. This array MUST have at least one - element. + This keyword's value MUST be an array. + This array MUST have at least one element. - Elements of the array MUST be objects. Each object MUST be a valid JSON - Schema. + Elements of the array MUST be objects. + Each object MUST be a valid JSON Schema. An instance validates successfully against this keyword if it validates @@ -664,19 +650,21 @@
- This keyword's value MUST be an object. This object MUST be a valid JSON - Schema. + This keyword's value MUST be an object. + This object MUST be a valid JSON Schema. An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword.
+
+
- This keyword's value MUST be an object. Each member value of this object - MUST be a valid JSON Schema. + This keyword's value MUST be an object. + Each member value of this object MUST be a valid JSON Schema. This keyword plays no role in validation per se. Its role is to provide @@ -707,9 +695,6 @@
-
- -
From a961689ba47dc504dc0378f5093e2e4db2807270 Mon Sep 17 00:00:00 2001 From: Austin Wright Date: Fri, 27 Jan 2017 15:49:36 -0700 Subject: [PATCH 2/5] Validation: Allow allOf/anyOf/oneOf/not to specify non-object schemas --- jsonschema-validation.xml | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index e9cd0c9a..c8fd1574 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -605,12 +605,8 @@
- This keyword's value MUST be an array. - This array MUST have at least one element. - - - Elements of the array MUST be objects. Each object MUST be a valid JSON - Schema. + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema. An instance validates successfully against this keyword if it validates @@ -620,12 +616,8 @@
- This keyword's value MUST be an array. - This array MUST have at least one element. - - - Elements of the array MUST be objects. - Each object MUST be a valid JSON Schema. + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema. An instance validates successfully against this keyword if it validates @@ -635,12 +627,8 @@
- This keyword's value MUST be an array. - This array MUST have at least one element. - - - Elements of the array MUST be objects. - Each object MUST be a valid JSON Schema. + This keyword's value MUST be a non-empty array. + Each item of the array MUST be a valid JSON Schema. An instance validates successfully against this keyword if it validates @@ -650,8 +638,7 @@
- This keyword's value MUST be an object. - This object MUST be a valid JSON Schema. + This keyword's value MUST be a valid JSON Schema. An instance is valid against this keyword if it fails to validate From 8947e93300fe5c66b3e82fca3b95299796669ee9 Mon Sep 17 00:00:00 2001 From: Austin Wright Date: Fri, 27 Jan 2017 15:52:40 -0700 Subject: [PATCH 3/5] Validation: Reword that sentence again --- jsonschema-validation.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index c8fd1574..088242db 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -162,7 +162,7 @@
- Most validation keywords only exclude a range of values within a certain primitive type. + Most validation keywords only constrain values within a certain primitive type. When the type of the instance is not of the type targeted by the keyword, the validation succeeds. From 52467922e6b8d8b1e754b0dbea287f80019a9b70 Mon Sep 17 00:00:00 2001 From: Austin Wright Date: Wed, 1 Feb 2017 04:41:04 -0700 Subject: [PATCH 4/5] Validation: Fix "same as" sentence for "items" too --- jsonschema-validation.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 088242db..4147a407 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -332,9 +332,6 @@ The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas. - - If absent, it can be considered present with an empty schema. - This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. @@ -348,6 +345,9 @@ each element of the instance validates against the schema at the same position, if any. + + A missing keyword has the same behavior as an empty schema. +
From d4122bf5d5193c24081e8a70083c8eae145562c3 Mon Sep 17 00:00:00 2001 From: Austin Wright Date: Wed, 1 Feb 2017 06:34:34 -0700 Subject: [PATCH 5/5] Validation: s/A missing/Omitting this/ --- jsonschema-validation.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 4147a407..5ee79278 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -311,7 +311,7 @@ characters as defined by RFC 7159. - A missing keyword has the same behavior as a value of 0. + Omitting this keyword has the same behavior as a value of 0.
@@ -346,7 +346,7 @@ same position, if any.
- A missing keyword has the same behavior as an empty schema. + Omitting this keyword has the same behavior as an empty schema.
@@ -369,7 +369,7 @@ applied to all elements.
- A missing keyword has the same behavior as an empty schema. + Omitting this keyword has the same behavior as an empty schema.
@@ -392,7 +392,7 @@ greater than, or equal to, the value of this keyword.
- A missing keyword has the same behavior as a value of 0. + Omitting this keyword has the same behavior as a value of 0.
@@ -406,7 +406,7 @@ successfully if all of its elements are unique.
- A missing keyword has the same behavior as a value of false. + Omitting this keyword has the same behavior as a value of false.
@@ -442,7 +442,7 @@ keyword.
- A missing keyword has the same behavior as a value of 0. + Omitting this keyword has the same behavior as a value of 0.
@@ -456,7 +456,7 @@ the name of a property in the instance. - A missing keyword has the same behavior as an empty array. + Omitting this keyword has the same behavior as an empty array.
@@ -476,7 +476,7 @@ corresponding schema.
- A missing keyword has the same behavior as an empty object. + Omitting this keyword has the same behavior as an empty object.
@@ -500,7 +500,7 @@ schema that corresponds to a matching regular expression.
- A missing keyword has the same behavior as an empty object. + Omitting this keyword has the same behavior as an empty object.
@@ -522,7 +522,7 @@ validates against the "additionalProperties" schema. - A missing keyword has the same behavior as an empty schema. + Omitting this keyword has the same behavior as an empty schema.
@@ -546,7 +546,7 @@ value must be a property that exists in the instance.
- A missing keyword has the same behavior as an empty object. + Omitting this keyword has the same behavior as an empty object.
@@ -560,7 +560,7 @@ Note the property name that the schema is testing will always be a string.
- A missing keyword has the same behavior as an empty schema. + Omitting this keyword has the same behavior as an empty schema.