Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 125 additions & 103 deletions jsonschema-validation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<!ENTITY RFC7159 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7159.xml">
]>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
Expand Down Expand Up @@ -172,31 +173,6 @@
</t>
</section>

<section title="Validation of primitive types and child values">
<t>
Two of the primitive types, array and object, allow for child values.
The validation of the primitive type is considered separately from
the validation of child instances.
</t>
<t>
For arrays, primitive type validation consists of validating
restrictions on length with "minItems" and "maxItems", while
"items" and "additionalItems" determine which subschemas apply
to which elements of the array. In addition, "uniqueItems"
and "contains" validate array contents as a whole.
</t>
<t>
For objects, primitive type validation consists of validating
restrictions on which and how many properties appear with
"required", "minProperties", "maxProperties", "propertyNames",
and the string array form of "dependencies", while "properties",
"patternProperties", and "additionalProperties" determine which
subschemas apply to which object property values.
In addition, the schema form of "dependencies" validates the
object as a whole based on the presence of specific property names.
</t>
</section>

<section title="Constraints and missing keywords">
<t>
Each JSON Schema validation keyword adds constraints that
Expand Down Expand Up @@ -239,6 +215,12 @@
Validation keywords in a schema impose requirements for successful validation of an instance.
</t>

<section title="Validation keywords for numeric instances (number and integer)">
<t>
These keywords apply only to numbers (including integers).
Validation of other types against these keywords always succeeds.
</t>

<section title="multipleOf">
<t>
The value of "multipleOf" MUST be a number, strictly greater than 0.
Expand Down Expand Up @@ -283,6 +265,13 @@
If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) "exclusiveMinimum".
</t>
</section>
</section>

<section title="Validation keywords for strings">
<t>
These keywords apply only to strings. Validation
of other types against these keywords always succeeds.
</t>

<section title="maxLength">
<t>
Expand Down Expand Up @@ -327,51 +316,18 @@
expressions are not implicitly anchored.
</t>
</section>

<section title="items">
<t>
The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas.
</t>
<t>
This keyword determines how child instances validate for arrays,
and does not directly validate the immediate instance itself.
</t>
<t>
If "items" is a schema, child validation succeeds if all elements
in the array successfully validate against that schema.
</t>
<t>
If "items" is an array of schemas, child validation succeeds if
each element of the instance validates against the schema at the
same position, if any.
</t>
<t>
Omitting this keyword has the same behavior as an empty schema.
</t>
</section>

<section title="additionalItems">
<section title="Validation keywords for arrays">
<t>
The value of "additionalItems" MUST be a valid JSON Schema.
</t>
<t>
This keyword determines how child instances validate for arrays,
and does not directly validate the immediate instance itself.
</t>
<t>
If "items" is an array of schemas, child validation succeeds
if every instance element at a position greater than the size
of "items" validates against "additionalItems".
These keywords apply only to arrays. Validation of other
instance types against these keywords always succeeds.
</t>
<section title="Basic array validation keywords">
<t>
Otherwise, "additionalItems" MUST be ignored, as the "items"
schema (possibly the default value of an empty schema) is
applied to all elements.
</t>
<t>
Omitting this keyword has the same behavior as an empty schema.
These keywords validate characteristics of arrays as a whole,
rather than validating specific array elements.
</t>
</section>

<section title="maxItems">
<t>
Expand Down Expand Up @@ -409,6 +365,51 @@
Omitting this keyword has the same behavior as a value of false.
</t>
</section>
</section>

<section title="Validating array elements with subschemas">
<t>
These keywords determine which subschemas apply to each element of an array,
and can be used to apply other schema vocabularies to child instances.
</t>
<section title="items">
<t>
The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas.
</t>
<t>
If "items" is a schema, validation succeeds if all elements
in the array successfully validate against that schema.
</t>
<t>
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.
</t>
<t>
Omitting this keyword has the same behavior as an empty schema.
</t>
</section>

<section title="additionalItems">
<t>
The value of "additionalItems" MUST be a valid JSON Schema.
</t>
<t>
If "items" is an array of schemas, validation against
"additionalItems" succeeds if every instance element at
a position greater than the size of "items" validates
against the "additionalItems" schema.
</t>
<t>
Otherwise, "additionalItems" MUST be ignored, as the "items"
schema is applied to all elements. Since omitting "items"
has the same behavior as an empty "items" schema, "additionalItems"
MUST be ignored if "items" is omitted.
</t>
<t>
Omitting this keyword has the same behavior as an empty schema.
</t>
</section>

<section title="contains">
<t>
Expand All @@ -420,6 +421,19 @@
its elements is valid against the given schema.
</t>
</section>
</section>
</section>

<section title="Validation keywords for objects">
<t>
These keywords apply only to objects. Validation of other
instance types against these keywords always succeeds.
</t>
<section title="Basic object validation keywords">
<t>
These keywords validate characteristics of objects
independent of the values of their properties.
</t>

<section title="maxProperties">
<t>
Expand Down Expand Up @@ -452,25 +466,29 @@
Elements of this array, if any, MUST be strings, and MUST be unique.
</t>
<t>
An object instance is valid against this keyword if every item in the array is
the name of a property in the instance.
An object instance is valid against this keyword if every item in the array
is the name of a property in the instance.
</t>
<t>
Omitting this keyword has the same behavior as an empty array.
</t>
</section>
</section>

<section title="Validating objects with subschemas">
<t>
These keywords determine which subschemas apply to an object,
its property name set, or specific property values within the object.
They can be used to apply other schema vocabularies to objects, their property names, or property values.
</t>

<section title="properties">
<t>
The value of "properties" MUST be an object.
Each value of this object MUST be a valid JSON Schema.
</t>
<t>
This keyword determines how child instances validate for objects,
and does not directly validate the immediate instance itself.
</t>
<t>
Child validation succeeds if, for each name that appears in both
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.
Expand All @@ -488,13 +506,7 @@
MUST be a valid JSON Schema.
</t>
<t>
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.
</t>
<t>
Child validation succeeds if, for each instance name that matches any
Validation succeeds if, for each instance property 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.
Expand All @@ -509,17 +521,25 @@
The value of "additionalProperties" MUST be a valid JSON Schema.
</t>
<t>
This keyword determines how child instances validate for objects,
and does not directly validate the immediate instance itself.
Validation succeeds if, for each instance property name
that does not match any names in "properties",
and does not match any regular expression in "patternProperties",
the child instance for that name successfully validates against
the "additionalProperties" schema.
</t>
<t>
Omitting this keyword has the same behavior as an empty schema.
</t>
</section>

<section title="propertyNames">
<t>
Child 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".
The value of "propertyNames" MUST be a valid JSON Schema.
</t>
<t>
For all such properties, child validation succeeds if the child instance
validates against the "additionalProperties" 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.
</t>
<t>
Omitting this keyword has the same behavior as an empty schema.
Expand All @@ -530,6 +550,8 @@
<t>
This keyword specifies rules that are evaluated if the instance is an object and
contains a certain property.
Validation against instances of types other than object
always succeeds.
</t>
<t>
This keyword's value MUST be an object. Each property specifies a dependency.
Expand All @@ -549,32 +571,24 @@
Omitting this keyword has the same behavior as an empty object.
</t>
</section>

<section title="propertyNames">
<t>
The value of "propertyNames" MUST be a valid JSON Schema.
</t>
<t>
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.
</t>
<t>
Omitting this keyword has the same behavior as an empty schema.
</t>
</section>
</section>

<section title="Validation keywords for any instance type">

<section title="Basic universal validation keywords">
<section title="enum">
<t>
The value of this keyword MUST be an array. This array SHOULD have at
least one element. Elements in the array SHOULD be unique.
</t>

<t>
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.
</t>
<t>
Elements in the array might be of any value, 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.
</t>
</section>

Expand Down Expand Up @@ -602,7 +616,13 @@
An instance validates if and only if the instance is in any of the sets listed for this keyword.
</t>
</section>
</section>

<section title="Applying subschemas with boolean logic">
<t>
These keywords combine or modify the validation results
of their subschema(s) with boolean operations.
</t>
<section title="allOf">
<t>
This keyword's value MUST be a non-empty array.
Expand Down Expand Up @@ -646,8 +666,8 @@
</t>
</section>
</section>
</section>

<section title="Metadata keywords">
<section title="definitions">
<t>
This keyword's value MUST be an object.
Expand All @@ -673,7 +693,7 @@
"definitions": {
"positiveInteger": {
"type": "integer",
"exclusiveMinimum": 0,
"exclusiveMinimum": 0
}
}
}
Expand All @@ -682,7 +702,9 @@
</figure>
</t>
</section>
</section>

<section title="Metadata keywords">
<section title='"title" and "description"'>
<t>
The value of both of these keywords MUST be a string.
Expand Down