Validation Vocabulary Official Included By Default
A vocabulary that defines keywords that impose requirements for successful validation of an instance.
Dialect | 2019-09 |
---|---|
URI | https://json-schema.org/draft/2019-09/vocab/validation |
Specification | https://json-schema.org/draft/2019-09/draft-handrews-json-schema-validation-02#rfc.section.6 |
Authors | |
Metaschema | https://json-schema.org/draft/2019-09/meta/validation |
Also see |
Your metaschema is likely already declaring this vocabulary
This vocabulary is included by default when using the official metaschema of this dialect: https://json-schema.org/draft/2019-09/schema. Unless you are using a custom metaschema, there is nothing else you need to do.
To make use of this vocabulary, modify your metaschema to declare the use of this vocabulary using the $vocabulary keyword and evaluate its metaschema. If the vocabulary must be present for an implementation to proceed:
{
...
"$vocabulary": {
...
"https://json-schema.org/draft/2019-09/vocab/validation": true
},
"allOf": [
{ "$ref": "https://json-schema.org/draft/2019-09/meta/validation" }
]
}
Otherwise, if it is optional for implementations to understand this vocabulary to proceed:
{
...
"$vocabulary": {
...
"https://json-schema.org/draft/2019-09/vocab/validation": false
},
"allOf": [
{ "$ref": "https://json-schema.org/draft/2019-09/meta/validation" }
]
}
Keywords
Keyword | Kind | Instance | Summary |
---|---|---|---|
type | Assertion | Any | Validation succeeds if the type of the instance matches the type represented by the given type, or matches at least one of the given types. |
enum | Assertion | Any | Validation succeeds if the instance is equal to one of the elements in this keyword’s array value. |
const | Assertion | Any | Validation succeeds if the instance is equal to this keyword’s value. |
minLength | Assertion | String | A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. |
maxLength | Assertion | String | A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. |
pattern | Assertion | String | A string instance is considered valid if the regular expression matches the instance successfully. |
maximum | Assertion | Number | Validation succeeds if the numeric instance is less than or equal to the given number. |
exclusiveMinimum | Assertion | Number | Validation succeeds if the numeric instance is greater than the given number. |
multipleOf | Assertion | Number | A numeric instance is valid only if division by this keyword’s value results in an integer. |
exclusiveMaximum | Assertion | Number | Validation succeeds if the numeric instance is less than the given number. |
minimum | Assertion | Number | Validation succeeds if the numeric instance is greater than or equal to the given number. |
dependentRequired | Assertion | Object | Validation succeeds if, for each name that appears in both the instance and as a name within this keyword’s value, every item in the corresponding array is also the name of a property in the instance. |
minProperties | Assertion | Object | An object instance is valid if its number of properties is greater than, or equal to, the value of this keyword. |
maxProperties | Assertion | Object | An object instance is valid if its number of properties is less than, or equal to, the value of this keyword. |
required | Assertion | Object | An object instance is valid against this keyword if every item in the array is the name of a property in the instance. |
minItems | Assertion | Array | An array instance is valid if its size is greater than, or equal to, the value of this keyword. |
maxItems | Assertion | Array | An array instance is valid if its size is less than, or equal to, the value of this keyword. |
minContains | Assertion | Array | The number of times that the contains keyword (if set) successfully validates against the instance must be greater than or equal to the given integer. |
maxContains | Assertion | Array | The number of times that the contains keyword (if set) successfully validates against the instance must be less than or equal to the given integer. |
uniqueItems | Assertion | Array | If this keyword is set to the boolean value true, the instance validates successfully if all of its elements are unique. |