Validation Vocabulary Official Included By Default

A vocabulary that defines keywords that impose requirements for successful validation of an instance.

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/2020-12/vocab/validation": true
  },
  "allOf": [
    { "$ref": "https://json-schema.org/draft/2020-12/meta/validation" }
  ]
}

Otherwise, if it is optional for implementations to understand this vocabulary to proceed:

{
  ...
  "$vocabulary": {
    ...
    "https://json-schema.org/draft/2020-12/vocab/validation": false
  },
  "allOf": [
    { "$ref": "https://json-schema.org/draft/2020-12/meta/validation" }
  ]
}

Keywords

Keyword Kind Instance Summary
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.
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.
exclusiveMaximum Assertion Number Validation succeeds if the numeric instance is less than the given number.
exclusiveMinimum Assertion Number Validation succeeds if the numeric instance is greater than the given number.
maximum Assertion Number Validation succeeds if the numeric instance is less 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.
maxProperties Assertion Object An object instance is valid if its number of properties is less 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.
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.