From e78d698cf33e271d48a82eda80925077cbd8c136 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Sun, 20 Aug 2017 02:25:53 -0700 Subject: [PATCH] Split validation keywords into sections. This improves the readability of the spec, particularly new readers trying to get a feel for the scope from the table of contents. A previous, more complex reorganization that was attempted before got plenty of support, and this more minimal change avoids the issues that bogged the previous approach down. Finally, having sections will make the section grouping "if", "then", and "else" make more sense. Adding those keywords without grouping the would seem odd. --- jsonschema-validation.xml | 774 +++++++++++++++++++------------------- 1 file changed, 393 insertions(+), 381 deletions(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 07546f1a..0299089a 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -251,421 +251,433 @@ instance. -
- - The value of "multipleOf" MUST be a number, strictly greater than 0. - - - A numeric instance is valid only if division by this keyword's value results in - an integer. - -
+
+
+ + The value of "multipleOf" MUST be a number, strictly greater than 0. + + + A numeric instance is valid only if division by this keyword's value results in + an integer. + +
-
- - The value of "maximum" MUST be a number, representing an inclusive upper limit - for a numeric instance. - - - If the instance is a number, then this keyword validates only if the instance is - less than or exactly equal to "maximum". - -
+
+ + The value of "maximum" MUST be a number, representing an inclusive upper limit + for a numeric instance. + + + If the instance is a number, then this keyword validates only if the instance is + less than or exactly equal to "maximum". + +
-
- - The value of "exclusiveMaximum" MUST be number, representing an exclusive upper - limit for a numeric instance. - - - If the instance is a number, then the instance is valid only if it has a value - strictly less than (not equal to) "exclusiveMaximum". - -
+
+ + The value of "exclusiveMaximum" MUST be number, representing an exclusive upper + limit for a numeric instance. + + + If the instance is a number, then the instance is valid only if it has a value + strictly less than (not equal to) "exclusiveMaximum". + +
-
- - The value of "minimum" MUST be a number, representing an inclusive lower limit - for a numeric instance. - - - If the instance is a number, then this keyword validates only if the instance is - greater than or exactly equal to "minimum". - -
+
+ + The value of "minimum" MUST be a number, representing an inclusive lower limit + for a numeric instance. + + + If the instance is a number, then this keyword validates only if the instance is + greater than or exactly equal to "minimum". + +
-
- - The value of "exclusiveMinimum" MUST be number, representing an exclusive lower - limit for a numeric instance. - - - If the instance is a number, then the instance is valid only if it has a value - strictly greater than (not equal to) "exclusiveMinimum". - +
+ + The value of "exclusiveMinimum" MUST be number, representing an exclusive lower + limit for a numeric instance. + + + If the instance is a number, then the instance is valid only if it has a value + strictly greater than (not equal to) "exclusiveMinimum". + +
-
- - 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. - - - The length of a string instance is defined as the number of its - characters as defined by RFC 7159. - -
+
+
+ + 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. + + + The length of a string instance is defined as the number of its + characters as defined by RFC 7159. + +
-
- - 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. - +
+ + 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. + - - The length of a string instance is defined as the number of its - characters as defined by RFC 7159. - - - Omitting this keyword has the same behavior as a value of 0. - -
+ + The length of a string instance is defined as the number of its + characters as defined by RFC 7159. + + + Omitting this keyword has the same behavior as a value of 0. + +
-
- - The value of this keyword MUST be a string. This string SHOULD be a - valid regular expression, according to the ECMA 262 regular expression - dialect. - - - A string instance is considered valid if the regular - expression matches the instance successfully. Recall: regular - expressions are not implicitly anchored. - +
+ + The value of this keyword MUST be a string. This string SHOULD be a + valid regular expression, according to the ECMA 262 regular expression + dialect. + + + A string instance is considered valid if the regular + expression matches the instance successfully. Recall: regular + expressions are not implicitly anchored. + +
-
- - The value of "items" MUST be either a valid JSON Schema or an array of valid - JSON Schemas. - - - This keyword determines how child instances validate for arrays, - and does not directly validate the immediate instance itself. - - - If "items" is a schema, validation succeeds if all elements - in the array successfully validate against that schema. - - - If "items" is an array of schemas, validation succeeds if - each element of the instance validates against the schema at the - same position, if any. - - - Omitting this keyword has the same behavior as an empty schema. - -
+
+
+ + The value of "items" MUST be either a valid JSON Schema or an array of valid + JSON Schemas. + + + This keyword determines how child instances validate for arrays, + and does not directly validate the immediate instance itself. + + + If "items" is a schema, validation succeeds if all elements + in the array successfully validate against that schema. + + + If "items" is an array of schemas, validation succeeds if + each element of the instance validates against the schema at the + same position, if any. + + + Omitting this keyword has the same behavior as an empty schema. + +
-
- - The value of "additionalItems" MUST be a valid JSON Schema. - - - This keyword determines how child instances validate for arrays, - and does not directly validate the immediate instance itself. - - - If "items" is an array of schemas, validation succeeds - if every instance element at a position greater than the size - of "items" validates against "additionalItems". - - - Otherwise, "additionalItems" MUST be ignored, as the "items" - schema (possibly the default value of an empty schema) is - applied to all elements. - - - Omitting this keyword has the same behavior as an empty schema. - -
+
+ + The value of "additionalItems" MUST be a valid JSON Schema. + + + This keyword determines how child instances validate for arrays, + and does not directly validate the immediate instance itself. + + + If "items" is an array of schemas, validation succeeds + if every instance element at a position greater than the size + of "items" validates against "additionalItems". + + + Otherwise, "additionalItems" MUST be ignored, as the "items" + schema (possibly the default value of an empty schema) is + applied to all elements. + + + Omitting this keyword has the same behavior as an empty schema. + +
-
- - The value of this keyword MUST be a non-negative integer. - - - An array instance is valid against "maxItems" if its size is - less than, or equal to, the value of this keyword. - -
+
+ + The value of this keyword MUST be a non-negative integer. + + + An array instance is valid against "maxItems" if its size is + less than, or equal to, the value of this keyword. + +
-
- - 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. - - - Omitting this keyword has the same behavior as a value of 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. + + + Omitting this keyword has the same behavior as a value of 0. + +
-
- - The value of this keyword MUST be a boolean. - - - If this keyword has boolean value false, the instance validates - successfully. If it has boolean value true, the instance validates - successfully if all of its elements are unique. - - - Omitting this keyword has the same behavior as a value of false. - -
+
+ + The value of this keyword MUST be a boolean. + + + If this keyword has boolean value false, the instance validates + successfully. If it has boolean value true, the instance validates + successfully if all of its elements are unique. + + + Omitting this keyword has the same behavior as a value of false. + +
-
- - The value of this keyword MUST be a valid JSON Schema. - - - An array instance is valid against "contains" if at least one of - its elements is valid against the given schema. - +
+ + The value of this keyword MUST be a valid JSON Schema. + + + An array instance is valid against "contains" if at least one of + its elements is valid against the given schema. + +
-
- - The value of this keyword MUST be a non-negative integer. - - - An object instance is valid against "maxProperties" if its - number of properties is less than, or equal to, the value of this - keyword. - -
+
+
+ + The value of this keyword MUST be a non-negative integer. + + + An object instance is valid against "maxProperties" if its + number of properties is less than, or equal to, the value of this + keyword. + +
-
- - The value of this keyword MUST be a non-negative integer. - - - An object instance is valid against "minProperties" if its - number of properties is greater than, or equal to, the value of this - keyword. - - - Omitting this keyword has the same behavior as a value of 0. - -
+
+ + The value of this keyword MUST be a non-negative integer. + + + An object instance is valid against "minProperties" if its + number of properties is greater than, or equal to, the value of this + keyword. + + + Omitting this 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. - - - An object instance is valid against this keyword if every item in the array is - the name of a property in the instance. - - - Omitting this keyword has the same behavior as an empty array. - -
+
+ + 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 every item in the array is + the name of a property in the instance. + + + Omitting this 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. - - - This keyword determines how child instances validate for objects, - and does not directly validate the immediate instance itself. - - - Validation succeeds if, for each name that appears in both - the instance and as a name within this keyword's value, the child - instance for that name successfully validates against the - corresponding schema. - - - Omitting this keyword has the same behavior as an empty object. - -
+
+ + 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, + and does not directly validate the immediate instance itself. + + + Validation succeeds if, for each name that appears in both + the instance and as a name within this keyword's value, the child + instance for that name successfully validates against the + corresponding schema. + + + Omitting this keyword has the same behavior as an empty object. + +
-
- - The value of "patternProperties" MUST be an object. Each property name - of this object SHOULD be a valid regular expression, according to the - ECMA 262 regular expression dialect. Each property value of this object - MUST be a valid JSON Schema. - - - This keyword determines how child instances validate for objects, - and does not directly validate the immediate instance itself. - Validation of the primitive instance type against this keyword - always succeeds. - - - Validation succeeds if, for each instance name that matches any - regular expressions that appear as a property name in this keyword's value, - the child instance for that name successfully validates against each - schema that corresponds to a matching regular expression. - - - Omitting this keyword has the same behavior as an empty object. - -
+
+ + The value of "patternProperties" MUST be an object. Each property name + of this object SHOULD be a valid regular expression, according to the + ECMA 262 regular expression dialect. Each property value of this object + MUST be a valid JSON Schema. + + + This keyword determines how child instances validate for objects, + and does not directly validate the immediate instance itself. + Validation of the primitive instance type against this keyword + always succeeds. + + + Validation succeeds if, for each instance name that matches any + regular expressions that appear as a property name in this keyword's value, + the child instance for that name successfully validates against each + schema that corresponds to a matching regular expression. + + + Omitting this keyword has the same behavior as an empty object. + +
-
- - The value of "additionalProperties" MUST be a valid JSON Schema. - - - This keyword determines how child instances validate for objects, - and does not directly validate the immediate instance itself. - - - Validation with "additionalProperties" applies only to the child - values of instance names that do not match any names in "properties", - and do not match any regular expression in "patternProperties". - - - For all such properties, validation succeeds if the child instance - validates against the "additionalProperties" schema. - - - Omitting this keyword has the same behavior as an empty schema. - -
+
+ + The value of "additionalProperties" MUST be a valid JSON Schema. + + + This keyword determines how child instances validate for objects, + and does not directly validate the immediate instance itself. + + + Validation with "additionalProperties" applies only to the child + values of instance names that do not match any names in "properties", + and do not match any regular expression in "patternProperties". + + + For all such properties, validation succeeds if the child instance + validates against the "additionalProperties" schema. + + + Omitting this keyword has the same behavior as an empty schema. + +
-
- - This keyword specifies rules that are evaluated if the instance is an object and - contains a certain property. - - - This keyword's value MUST be an object. Each property specifies a dependency. - Each dependency value MUST be an array or a valid JSON Schema. - - - If the dependency value is a subschema, and the dependency key is a property - in the instance, the entire instance must validate against the dependency value. - - - If the dependency value is an array, each element in the array, - if any, MUST be a string, and MUST be unique. If the dependency key is - a property in the instance, each of the items in the dependency - value must be a property that exists in the instance. - - - Omitting this keyword has the same behavior as an empty object. - -
+
+ + This keyword specifies rules that are evaluated if the instance is an object and + contains a certain property. + + + This keyword's value MUST be an object. Each property specifies a dependency. + Each dependency value MUST be an array or a valid JSON Schema. + + + If the dependency value is a subschema, and the dependency key is a property + in the instance, the entire instance must validate against the dependency value. + + + If the dependency value is an array, each element in the array, + if any, MUST be a string, and MUST be unique. If the dependency key is + a property in the instance, each of the items in the dependency + value must be a property that exists in the instance. + + + Omitting this keyword has the same behavior as an empty object. + +
-
- - The value of "propertyNames" MUST be a valid JSON Schema. - - - If the instance is an object, this keyword validates if every property name in - the instance validates against the provided schema. - Note the property name that the schema is testing will always be a string. - - - Omitting this keyword has the same behavior as an empty schema. - +
+ + The value of "propertyNames" MUST be a valid JSON Schema. + + + If the instance is an object, this keyword validates if every property name in + the instance validates against the provided schema. + Note the property name that the schema is testing will always be a string. + + + Omitting this keyword has the same behavior as an empty schema. + +
-
- - The value of this keyword MUST be an array. This array SHOULD have at - least one element. Elements in the array SHOULD be unique. - - - 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. - -
+
+
+ + The value of this keyword MUST be an array. This array SHOULD have at + least one element. Elements in the array SHOULD be unique. + + + 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. + +
-
- - The value of this keyword MAY be of any type, including null. - - - An instance validates successfully against this keyword if its value is - equal to the value of the keyword. - -
+
+ + The value of this keyword MAY be of any type, including null. + + + An instance validates successfully against this keyword if its value is + equal to the value of the keyword. + +
-
- - The value of this keyword MUST be either a string or an array. If it is - an array, elements of the array MUST be strings and MUST be unique. - - - String values MUST be one of the six primitive types - ("null", "boolean", "object", "array", "number", or "string"), - or "integer" which matches any number with a zero fractional part. - - - An instance validates if and only if the instance is in any of the sets listed - for this keyword. - +
+ + The value of this keyword MUST be either a string or an array. If it is + an array, elements of the array MUST be strings and MUST be unique. + + + String values MUST be one of the six primitive types + ("null", "boolean", "object", "array", "number", or "string"), + or "integer" which matches any number with a zero fractional part. + + + An instance validates if and only if the instance is in any of the sets listed + for this keyword. + +
-
- - 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 - successfully against all schemas defined by this keyword's value. - -
+
+
+ + 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 + successfully against all schemas defined by this keyword's value. + +
-
- - 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 - successfully against at least one schema defined by this keyword's value. - -
+
+ + 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 + successfully against at least one schema defined by this keyword's value. + +
-
- - 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 - successfully against exactly one schema defined by this keyword's value. - -
+
+ + 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 + successfully against exactly one schema defined by this keyword's value. + +
-
- - This keyword's value 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 a valid JSON Schema. + + + An instance is valid against this keyword if it fails to validate + successfully against the schema defined by this keyword. + +