JSON Schema Components
Schema
Description: Defines the root element of a JSON schema. A JSON schema document contains all the steps that are necessary to be performed to validate JSON documents and it contains a collection of JSON schema components.
Property
Description: Each key:value
pair
is known as a property of the object. The value can be any JSON data
type.
Properties
any
type
property value. You can also convert a boolean any type
property into a standard type
property using the Convert
property to standard type contextual menu action.Pattern Property
Description: Maps regular expressions to schemas. If a property name matches the given regular expression, the property value must validate against the corresponding schema.
Pattern Properties
Description: An object is valid against the patternProperties keyword if every property where a property name (key) matches a regular expression from the value of this keyword is also valid against the corresponding schema. The value must be an object where the keys must be valid regular expressions and the corresponding values must be valid JSON schemas (object or boolean).
Unevaluated Properties (for 2019-09 or 2020-12 schemas)
Description: An object is valid against the unevaluatedProperties keyword if every unevaluated property is valid against the schema defined by the value of this keyword. Unevaluated properties are the properties that were not evaluated anywhere in the current schema. This keyword can see through adjacent keywords, such as allOf.
Definition
Description: The definition of a component of a schema. It can be referenced from a property to define its specification.
Definitions
any type
property value.
You can also convert a definition's boolean any type
property into a
standard type
property using the Convert definition to
standard type contextual menu action.Additional Properties
Description:
An object is valid against the additionalProperties keyword if all unchecked properties are valid against the schema defined by the value of this keyword. Unchecked properties are the properties not checked by the properties and patternProperties keywords (if a property name is not present in the properties keyword and does not match any regular expression defined by the patternProperties keyword, then it is considered unchecked). The value must be a valid JSON schema (object or boolean).
- If the value of the additionalProperties keyword is true, it is always valid.
- If the value is false, it is never valid.
- If the value contains an object (schema), every property must be valid against that schema.
Additional Items
Description: An array is valid against the additionalItems keyword if all unchecked items are valid against the schema defined by the keyword value. An item is considered unchecked if the items keyword or prefixItems keyword (starting with 2020-12) contains an array of schemas and does not have a corresponding position (index). The value must be a valid JSON schema (object or boolean).
Items
- A valid JSON schema (object or boolean). Every item must be valid against this schema.
- An array of valid JSON schemas. Each item must be valid against the schema defined at the same position (index). Items that do not have a corresponding position (e.g. an array contains 5 items but this keyword only has 3) are considered valid unless the additionalItems keyword is present, which will decide the validity.
Prefix Items (for 2020-12 schemas)
Description: An array is valid against the prefixItems keyword if items are valid against the corresponding schemas provided by the keyword value. The value of this keyword must be an array of valid JSON schemas and each item must be valid against the schema defined at the same position (index). Items that do not have a corresponding position (an array contains 5 items and this keyword only has 3) will be considered valid, unless the items keyword is present (which will decide the validity).
Unevaluated Items (for 2019-09 or 2020-12 schemas)
Description: An object is valid against the unevaluatedItems keyword if every unevaluated item is valid against the schema defined by the value of this keyword. Unevaluated items are the items that were not evaluated anywhere in the current schema. This keyword can see through adjacent keywords, such as allOf.
AllOf
Description: An instance is valid against the allOf keyword if it is valid against all schemas defined by the value of this keyword. The value of this keyword must be an array of valid JSON schemas (objects or boolean).
AnyOf
Description: An instance is valid against the anyOf keyword if it is valid against at least one schema defined by the value of this keyword. The value must be an array of valid JSON schemas (objects or boolean).
OneOf
Description: An instance is valid against the oneOf keyword if it is valid against exactly one schema defined by the value of this keyword. The value must be an array of valid JSON schemas (object or boolean).
Not
Description: An instance is valid against the not keyword if it is not valid against the schema defined by the value of this keyword. The value must be a valid JSON schema (object or boolean).
If/Then/Else
- The if keyword validates the instance and the then keyword also validates it.
- The if keyword does not validate the instance but the else keyword validates it.
Dependencies
Description: An object is valid against the dependencies keyword if it meets all dependencies specified by this keyword value. Only property names (from this keyword value) that are also present in the object are checked. The value of this keyword must be an object, where property values can be:
-
Objects representing valid JSON schemas and the whole object must match the entire schema.Important: For draft 2019-09 and 2020-12 schemas, you should use the dependentSchemas keyword instead.
-
Arrays of strings representing property names, then the object must contain all property names.Important: For draft 2019-09 and 2020-12 schemas, you should use the dependentRequired keyword instead.
Dependent Required (for 2019-09 or 2020-12 schemas)
Description: An object is valid against the dependentRequired keyword if it meets all dependencies specified by this keyword value. The value of this keyword must be an object where property values must be arrays of strings representing property names, and the object must contain all property names. Only property names (from this keyword value) that are also present in the object are checked.
Dependent Schemas (for 2019-09 or 2020-12 schemas)
Description: An object is valid against the dependentSchemas keyword if it meets all dependencies specified by this keyword value. The value of this keyword must be an object where property values must be objects representing valid JSON schemas, and the whole object must match the entire schema. Only property names (from this keyword value) that are also present in the object are checked.