Draft 4 Dialect

JSON Schema Draft 4 is a JSON media type that provides a contract for what JSON data is required for a given application and how to interact with it. JSON Schema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data.

Using this dialect

To make use of this dialect, declare your schemas to have the dialect metaschema using the $schema keyword. For example:

{
  "$schema": "http://json-schema.org/draft-04/schema#" 
}

Citing this dialect

The recommended way to cite the JSON Schema Draft 4 dialect using BibTex is as follows:

@techreport{json-schema-draft4,
  title = { JSON Schema: A JSON based format for defining the structure of JSON data },
  author = { Galiegue, Francis and Zyp, Kris and Court, Gary },
  organization = { JSON Schema },
  year = { 2013 },
  url = { https://json-schema.org/draft-04/draft-zyp-json-schema-04 }
}

Vocabularies

A curated set of vocabularies defined for this JSON Schema dialect.

Core Official Included By Default

This vocabulary defines JSON Schema core terminology and mechanisms; related specifications build upon this specification and define different applications of JSON Schema. Read more about this vocabulary.

Keyword Kind Instance Summary
id Identifier Any This keyword declares an identifier for the schema resource.
$schema Identifier Any This keyword is both used as a JSON Schema dialect identifier and as a reference to a JSON Schema which describes the set of valid schemas written for this particular dialect.
$ref Applicator Any This keyword is used to reference a statically identified schema.

Validation Official Included By Default

A vocabulary that defines keywords that impose requirements for successful validation of an instance. Read more about this vocabulary.

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.
multipleOf Assertion Number A numeric instance is valid only if division by this keyword’s value results in an integer.
maximum Assertion Number Validation succeeds if the numeric instance is less than or less than or equal to the given number, depending on the value of exclusiveMaximum, if any
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 greater than or equal to the given number, depending on the value of exclusiveMinimum, if any
exclusiveMinimum Assertion Number When minimum is present and this keyword is set to true, the numeric instance must be greater than the value in minimum.
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.
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.
pattern Assertion String A string instance is considered valid if the regular expression matches the instance successfully.
items Applicator Array If set to a schema, validation succeeds if each element of the instance validates against it, otherwise validation succeeds if each element of the instance validates against the schema at the same position, if any
additionalItems Applicator Array If items is set to an array of schemas, validation succeeds if each element of the instance not covered by it validates against this schema. If set to false, no additional items are allowed in the array instance.
maxItems Assertion Array An array instance is valid if its size is less than, or equal to, the value of this keyword.
minItems Assertion Array An array instance is valid if its size is greater than, or equal to, the value of this keyword.
uniqueItems Assertion Array If this keyword is set to the boolean value true, the instance validates successfully if all of its elements are unique.
maxProperties Assertion Object An object instance is valid if its number of properties is less than, or equal to, the value of this keyword.
minProperties Assertion Object An object instance is valid if its number of properties is greater 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.
properties Applicator Object 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.
patternProperties Applicator Object 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.
additionalProperties Applicator Object Validation succeeds if the schema validates against each value not matched by other object applicators in this vocabulary. If set to false, no additional properties are allowed in the instance.
dependencies Assertion Object Validation succeeds if, for each name that appears in both the instance and as a name within this keyword’s value, either every item in the corresponding array is also the name of a property in the instance or the corresponding subschema successfully evaluates against the instance.
allOf Applicator Any An instance validates successfully against this keyword if it validates successfully against all schemas defined by this keyword’s value.
anyOf Applicator Any An instance validates successfully against this keyword if it validates successfully against at least one schema defined by this keyword’s value.
oneOf Applicator Any An instance validates successfully against this keyword if it validates successfully against exactly one schema defined by this keyword’s value.
not Applicator Any An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword.
format Annotation String Define semantic information about a string instance.
definitions Reserved Location Any This keyword reserves a location for schema authors to inline re-usable JSON Schemas into a more general schema.
title Annotation Any A preferably short description about the purpose of the instance described by the schema.
description Annotation Any An explanation about the purpose of the instance described by the schema.
default Annotation Any This keyword can be used to supply a default JSON value associated with a particular schema.