Draft 6 Dialect

JSON Schema Draft 6 is a JSON media type for defining the structure of JSON data. 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-06/schema#" 
}

Citing this dialect

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

@techreport{json-schema-draft6,
  title = { JSON Schema: A Media Type for Describing JSON Documents },
  author = { Wright, Austin and Andrews, Henry and Luff, Geraint },
  organization = { JSON Schema },
  year = { 2017 },
  url = { https://json-schema.org/draft-06/draft-wright-json-schema-01 }
}

Vocabularies

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

Core Official Included By Default

The vocabulary that defines JSON Schema core terminology and mechanisms, including pointing to another JSON Schema by reference, dereferencing a JSON Schema reference, and specifying the vocabulary being used. 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.
const Assertion Any Validation succeeds if the instance is equal to this keyword’s 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 equal to the given number.
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.
exclusiveMinimum Assertion Number Validation succeeds if the numeric instance is greater than the given number.
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.
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.
contains Applicator Array Validation succeeds if the instance contains an element that validates against this schema.
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.
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.
propertyNames Applicator Object Validation succeeds if the schema validates against every property name in 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.
examples Annotation Any This keyword is used to provide sample JSON values associated with a particular schema, for the purpose of illustrating usage.