A schema must be a JSON object or a boolean: true always passes (like
{}) and false always fails (like
{ "not": {} }). This page follows JSON Schema 2020-12, whose keywords are
grouped into vocabularies:
JSON Schema Core
and JSON Schema
Validation (as served there, draft-bhutton-json-schema-01 and
draft-bhutton-json-schema-validation-01, 16 June 2022), read 2026-11-12. The drafts table
follows json-schema.org’s
specification links, the
release notes for draft
6, draft 7,
2019-09 and
2020-12, and the
published meta-schemas, read 2026-11-12.
Core
The Core vocabulary’s keywords all begin with $, and the Core
vocabulary is always required.
| Keyword | Meaning |
|---|---|
$schema | The dialect, as the URI of a meta-schema the schema must validate against; see drafts. |
$id | Identifies a schema resource with its canonical URI, which also becomes the base URI for relative references inside it. |
$ref | Applies the schema at a URI-reference resolved against the base URI, such as #/$defs/positiveInteger. Other keywords may sit beside it. |
$anchor | A plain-name fragment ("foo" becomes #foo): a letter or _, then letters, digits, -, _ or .. |
$dynamicRef, $dynamicAnchor | References resolved at evaluation time through the dynamic scope, for extending recursive schemas. |
$vocabulary | In meta-schemas: which vocabularies are available, each marked required (true) or optional (false). |
$comment | A comment from schema authors to readers or maintainers; never shown to end users. |
$defs | A place for reusable schemas; does not affect validation directly. |
Applicators
These keywords are in the Applicator vocabulary, except the two
unevaluated keywords, which 2020-12 moved into their own Unevaluated
vocabulary.
| Keyword | Applies to |
|---|---|
allOf, anyOf, oneOf, not | Combine schemas. |
if, then, else | Conditional schemas. |
dependentSchemas | Schemas applied to the whole object when a property is present. |
prefixItems, items | Array elements by position, then the rest. |
contains | At least one element must match, unless minContains is 0. |
properties, patternProperties, additionalProperties | Object members by name, by regular expression, and the rest. |
propertyNames | Every member name. |
unevaluatedItems, unevaluatedProperties (Unevaluated vocabulary) | Elements and members not successfully evaluated by adjacent keywords, including through sub-schemas and references. |
Validation
The Validation vocabulary’s keywords are all assertions.
| For | Keywords |
|---|---|
| Any value | type (null, boolean, object, array, number, string, or integer for any number with a zero fractional part; or an array of unique names), enum, const. |
| Numbers | multipleOf, maximum, exclusiveMaximum, minimum, exclusiveMinimum. |
| Strings | maxLength, minLength (counting characters as RFC 8259 defines them), pattern (ECMA-262 regular expression, not implicitly anchored). |
| Arrays | maxItems, minItems, uniqueItems, maxContains, minContains. |
| Objects | maxProperties, minProperties, required, dependentRequired. |
Formats
format has two vocabularies. Under Format-Annotation (the one the
default meta-schema requires) it is collected as an annotation; an implementation may
also check it, but only through an option that is off by default. Under
Format-Assertion it must be validated, and an implementation that cannot do so must
refuse the schema. Defined values: date-time, date, time,
duration, email, idn-email,
hostname, idn-hostname, ipv4,
ipv6, uri, uri-reference, iri,
iri-reference, uuid, uri-template,
json-pointer, relative-json-pointer,
regex.
Content and meta-data
Content vocabulary: contentEncoding (such as base64,
from RFC 4648 or RFC 2045), contentMediaType,
contentSchema. Meta-Data vocabulary: title,
description, default, deprecated,
readOnly, writeOnly, examples.
Drafts
| Draft | $schema | Main changes |
|---|---|---|
| Draft 4 (31 January 2013) | http://json-schema.org/draft-04/schema# | id without $; boolean exclusiveMaximum and exclusiveMinimum beside maximum and minimum; definitions. |
| Draft 5 (13 October 2016) | None of its own; keeps the draft 4 meta-schemas | A cleanup of draft 4 (draft-wright-json-schema-00); json-schema.org says not to implement or advertise “draft-05”. |
| Draft 6 (21 April 2017) | http://json-schema.org/draft-06/schema# | $id; numeric exclusive limits; const, contains, propertyNames, examples; boolean schemas allowed anywhere; 1.0 counts as an integer. |
| Draft 7 (19 March 2018) | http://json-schema.org/draft-07/schema# | if/then/else, $comment, writeOnly; readOnly, contentMediaType and contentEncoding moved in from Hyper-Schema. |
| 2019-09 (17 September 2019) | https://json-schema.org/draft/2019-09/schema | Vocabularies; definitions renamed $defs; $anchor; dependencies split into dependentSchemas and dependentRequired; unevaluatedItems, unevaluatedProperties; $recursiveRef, $recursiveAnchor; maxContains, minContains, contentSchema, deprecated. |
| 2020-12 (revised 16 June 2022) | https://json-schema.org/draft/2020-12/schema | prefixItems takes over array-form items, and items takes over additionalItems; $dynamicRef, $dynamicAnchor replace $recursiveRef, $recursiveAnchor; Unevaluated vocabulary split from Applicator; format split into Format-Annotation and Format-Assertion; items matched by contains count as evaluated. |
The OpenAPI 3.1.0 Schema Object is a superset of JSON Schema 2020-12; the OpenAPI 3.0.3 Schema Object is an extended subset of JSON Schema “Wright Draft 00”, which is draft 5. Both from the OpenAPI 3.1.0 and OpenAPI 3.0.3 specifications, read 2026-11-12.
Annotations
From the 2020-12 core specification, section 7.7 (read 2026-11-13).
- An annotation attaches information to a location in the instance whenever the instance validates against the schema object holding the keyword and all of its parent schema objects. Unless a keyword says otherwise, its annotation is its own value (JSON Hyper-Schema's
linksis a computed one). Implementations need not use the information; it is for applications. - A collected annotation carries: the keyword name; the instance location as a JSON Pointer; the schema location path (showing how
$refand similar were followed); the absolute schema location as a URI (which may be left out when it equals the path); and the attached value or values. Boolean schemas have no keywords and so produce none. - Collecting needs every schema that applies to a location to be examined, even if it cannot change the result; only subschemas of a schema object that has already failed may be skipped, because failing schemas keep no annotations. A schema object whose assertion result is false produces no annotations, from its own keywords or from subschemas (in
oneOf [{title: "Integer Value", type: integer}, {title: "String Value", type: string}]against a string, the first title is discarded). - When several values meet at one location, the application decides which to use, possibly by their schema locations: for example the most specific
defaultand alldescriptions from the most general to the most specific. Applicator keywords aggregate the annotations of their subschemas and referenced schemas. - Keywords that reserve locations (
$defsand the like) affect neither validation nor annotations.
Output formats
Core section 12. Output is the JSON data model; four formats exist. An implementation should provide at least one of flag, basic or detailed, may provide verbose, must provide flag if it provides detailed or verbose, and should document its formats.
| Format | Shape |
|---|---|
| Flag | {"valid": false} only; implementations should stop as soon as the result is known. |
| Basic | valid plus a flat list: errors (failed) or annotations (passed) of output units. |
| Detailed | A condensed hierarchy following the schema: every applicator keyword needs a node; nodes without children are removed; a node with one child is replaced by it; branch nodes need no message. |
| Verbose | The full hierarchy matching the schema, including results that Detailed removes (annotations of failures, passes inside not); each node should carry valid. |
An output unit should hold at least: keywordLocation (a JSON Pointer to the validating keyword along the validation path, including $ref and $dynamicRef, such as /properties/width/$ref/minimum); absoluteKeywordLocation (a full URI of the canonical schema resource with a pointer fragment, never passing $ref as a non-terminal part, omittable only if the dynamic scope did not pass a reference or the schema has no absolute $id); instanceLocation (a JSON Pointer); and error (failed; the wording is not defined) or annotation (passed; by default the keyword's value). Hierarchies hold nested results under errors or annotations (plural). The output is an object with a boolean valid. A validating schema for output is at https://json-schema.org/draft/2020-12/output/schema.
{ "valid": false,
"errors": [
{ "keywordLocation": "", "instanceLocation": "", "error": "A subschema had errors." },
{ "keywordLocation": "/items/$ref/required",
"absoluteKeywordLocation": "https://example.com/polygon#/$defs/point/required",
"instanceLocation": "/1", "error": "Required property 'y' not found." },
{ "keywordLocation": "/minItems", "instanceLocation": "", "error": "Expected at least 3 items but found 2" } ] }
Meta-schemas and vocabularies
The 2020-12 meta-schema https://json-schema.org/draft/2020-12/schema
declares $vocabulary (read 2026-11-13) with each vocabulary URI set true
(required) and combines the vocabulary meta-schemas through allOf. The Core
vocabulary must always be treated as mandatory and, where $vocabulary is
used, listed with the value true.
Vocabulary (https://json-schema.org/draft/2020-12/vocab/…) | Keywords (from its meta-schema) |
|---|---|
core | $id, $schema, $ref, $anchor, $dynamicRef, $dynamicAnchor, $vocabulary, $comment, $defs |
applicator | prefixItems, items, contains, additionalProperties, properties, patternProperties, dependentSchemas, propertyNames, if, then, else, allOf, anyOf, oneOf, not |
unevaluated | unevaluatedItems, unevaluatedProperties |
validation | type, const, enum, multipleOf, maximum, exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, maxItems, minItems, uniqueItems, maxContains, minContains, maxProperties, minProperties, required, dependentRequired |
meta-data | title, description, default, deprecated, readOnly, writeOnly, examples |
format-annotation, format-assertion | format: the first (in the standard meta-schema, value true) makes it an annotation; the second is not in the standard meta-schema and makes it an assertion. |
content | contentEncoding, contentMediaType, contentSchema |
The 2020-12 meta-schema also lists definitions and dependencies
(deprecated, kept so that incompatible extensions are not made), and $recursiveAnchor and
$recursiveRef. The 2019-09 meta-schema's vocabularies are core,
applicator, validation, meta-data,
format (declared false: not required) and content under
https://json-schema.org/draft/2019-09/vocab/; its core keywords are
$id, $schema, $anchor, $ref,
$recursiveRef, $recursiveAnchor, $vocabulary,
$comment, $defs.
Keywords of drafts 4, 6 and 7
The members of each draft's meta-schema (json-schema.org/draft-NN/schema,
read 2026-11-13); drafts before 2019-09 have no vocabularies.
| Draft | Keywords |
|---|---|
| 4 | id, $schema, title, description, default, multipleOf, maximum, exclusiveMaximum, minimum, exclusiveMinimum (the two exclusive ones are booleans qualifying the limits), maxLength, minLength, pattern, additionalItems, items, maxItems, minItems, uniqueItems, maxProperties, minProperties, required, additionalProperties, definitions, properties, patternProperties, dependencies, enum, type, format, allOf, anyOf, oneOf, not. |
| 6 | As draft 4 with $id replacing id, plus $ref, examples, contains, propertyNames, const; the exclusive limits are numbers. |
| 7 | As draft 6, plus $comment, readOnly, writeOnly, contentMediaType, contentEncoding, if, then, else. |
additionalItems and array-form items belong to drafts 4 to
2019-09; in 2020-12 prefixItems takes the array form of items and
items takes the place of additionalItems.
dependencies (drafts 4 to 7) is split into dependentRequired
and dependentSchemas in 2019-09; definitions becomes
$defs.
What the meta-schemas constrain
Each member below is the constraint the meta-schema places on the keyword's value; the
JSON files were downloaded from json-schema.org on 2026-11-13 and read in full.
“Non-negative integer” is {"type":"integer","minimum":0}.
2020-12 (meta/core, meta/applicator, meta/unevaluated, meta/validation, meta/meta-data, meta/format-annotation, meta/format-assertion, meta/content)
Every vocabulary meta-schema has "$dynamicAnchor": "meta", "type": ["object", "boolean"] and its own $id under https://json-schema.org/draft/2020-12/meta/. The standard meta-schema combines the seven (not format-assertion) with allOf, has "type": ["object", "boolean"], and its $comment says it also defines keywords from earlier drafts to prevent incompatible extensions.
| Keyword | Constraint on its value |
|---|---|
$id | String, format: uri-reference, and pattern: ^[^#]*#?$ (comment: “Non-empty fragments not allowed”). |
$schema | String, format: uri. |
$ref, $dynamicRef | String, format: uri-reference. |
$anchor, $dynamicAnchor | String matching ^[A-Za-z_][-A-Za-z0-9._]*$. |
$vocabulary | Object whose property names are strings of format: uri and whose values are booleans. |
$comment | String. |
$defs | Object whose values are schemas ($dynamicRef: #meta). |
prefixItems, allOf, anyOf, oneOf | Array of at least 1 item (minItems: 1), each a schema. |
items, contains, additionalProperties, propertyNames, if, then, else, not, unevaluatedItems, unevaluatedProperties, contentSchema | A schema. |
properties, dependentSchemas | Object of schemas; default {} for properties (dependentSchemas has no default in 2020-12). |
patternProperties | Object of schemas whose property names have format: regex; default {}. |
type | One of array, boolean, integer, null, number, object, string, or a non-empty array (minItems: 1) of unique such names. |
const | Anything (true). |
enum | Array of anything (no minItems, no uniqueItems in 2020-12). |
multipleOf | Number with exclusiveMinimum: 0. |
maximum, exclusiveMaximum, minimum, exclusiveMinimum | Number. |
maxLength, maxItems, maxContains, maxProperties | Non-negative integer. |
minLength, minItems, minProperties | Non-negative integer, default 0. |
minContains | Non-negative integer, default 1. |
pattern | String, format: regex. |
uniqueItems | Boolean, default false. |
required | Array of unique strings, default [] (stringArray; no minItems). |
dependentRequired | Object whose values are stringArrays. |
title, description | String. |
default | Anything. |
deprecated, readOnly, writeOnly | Boolean, default false. |
examples | Array of anything. |
format | String (both format vocabularies). |
contentEncoding, contentMediaType | String. |
definitions | Object of schemas; deprecated: true, default {}. |
dependencies | Object whose values are a schema or a stringArray; deprecated, default {}. |
$recursiveAnchor, $recursiveRef | As $anchor and $ref (anchor string, uri-reference string); deprecated. |
2019-09 differences
The 2019-09 meta-schemas use "$recursiveAnchor": true and $recursiveRef: "#" where 2020-12 uses $dynamicAnchor and $dynamicRef; the vocabularies are core, applicator (which includes unevaluatedItems and unevaluatedProperties), validation, meta-data, format and content. Its $anchor pattern is ^[A-Za-z][-A-Za-z0-9.:_]*$ (a letter first, and : allowed); $recursiveAnchor is a boolean, default false; $defs has default {}; items is a schema or a schemaArray (additionalItems is a schema); dependentSchemas is an object of schemas; contentSchema is a schema. validation has the same constraints as in 2020-12. Its meta-data and content meta-schemas are as 2020-12 except for the recursion keyword and the absence of $dynamicAnchor.
Drafts 4, 6 and 7 (single meta-schema each)
| Point | Draft 4 | Draft 6 | Draft 7 |
|---|---|---|---|
| Root type | object | ["object", "boolean"] | ["object", "boolean"] |
Root default | {} | {} | true |
id / $id | id: string | $id: string, format: uri-reference | same as draft 6 |
$schema | string | string, format: uri | same |
$ref | none in the meta-schema | string, format: uri-reference | same |
multipleOf | number, minimum: 0, exclusiveMinimum: true | number, exclusiveMinimum: 0 | same as draft 6 |
exclusiveMaximum, exclusiveMinimum | boolean, default false; a dependency requires maximum or minimum beside them | number | number |
maxLength and the other counts | positiveInteger (integer, minimum 0); minLength etc. default 0 | nonNegativeInteger, same limits | same |
additionalItems, additionalProperties | boolean or schema, default {} | a schema (booleans are schemas) | a schema |
items | schema or schemaArray, default {} | same, default {} | same, default true |
required | unique strings, minItems: 1 | unique strings, default [] | same as draft 6 |
enum | array, minItems: 1, uniqueItems: true | same | same plus items: true |
const, contains, propertyNames, examples | not present | present (examples: array) | present |
patternProperties | object of schemas | object of schemas, with propertyNames: {format: regex} | same as draft 6 |
$comment, readOnly, writeOnly, contentMediaType, contentEncoding, if, then, else | not present | not present | present (strings, booleans default false, schemas) |
definitions, properties | object of schemas, default {} | same | same |
dependencies | object of schema or unique string array (minItems 1) | object of schema or stringArray | same as draft 6 |
format | string | string | string |
type | One of the seven simple types or a non-empty array of unique ones, in all three. | ||
allOf, anyOf, oneOf, not | schemaArray (array with minItems: 1 of schemas) for the first three, a schema for not, in all three. | ||
Identifiers, base URI and references
From the 2020-12 core specification, sections 8.1 to 9.4 (downloaded 2026-11-13).
$schema(8.1.1): a URI containing a scheme, normalised; the schema must validate against the meta-schema it names; a retrievable meta-schema should be served asapplication/schema+json. It should appear in the document root, may appear in the root of an embedded resource, and must not appear in a non-resource subschema. If absent from the document root the behaviour is implementation-defined.$vocabulary(8.1.2): in a meta-schema only, in the root, never in subschemas, and ignored when the document is not being processed as a meta-schema. Names are normalised URIs with a scheme (they may be URLs, though what they retrieve is reserved). Atruevalue means an implementation that does not recognise the vocabulary must refuse to process schemas using the meta-schema;falsemeans it should carry on. Unrecognised keywords are annotations. The Core vocabulary must always be listed withtrue; false, or$vocabularywithout Core, is undefined (an error is recommended).- Default vocabularies (8.1.2.1): without
$vocabulary, behaviour may follow a recognised$schemaURI; otherwise it is implementation-defined, Core must be assumed, and a validator should assume all vocabularies of Core and Validation. - Non-inheritance (8.1.2.2): a meta-schema that
$refs another does not inherit its$vocabulary; every declaration must be repeated in the root of each meta-schema document. - Updated URIs (8.1.3): meta-schema and vocabulary URIs dated after a draft and before the next mean the same syntax and semantics.
$id(8.2.1): a string, a valid URI-reference that should be normalised and must resolve to an absolute-URI without fragment (or with an empty fragment, which is not recommended; a non-empty fragment is forbidden). The absolute-URI form is the canonical URI and the base URI (RFC 3986 section 5.1.1) for relative references within the resource.$idin a subschema starts a new schema resource; a relative$idthere resolves against the parent resource's URI, or against the document base URI if no parent has one. The root schema should have an absolute$id(8.2.1.1).- Anchors (8.2.2):
$anchorand$dynamicAnchorcreate plain-name fragments (^[A-Za-z_][-A-Za-z0-9._]*$, the US-ASCII part of XML NCName) appended to the canonical URI of the containing resource ("$anchor": "foo"gives#foo). The same fragment name twice in one resource is undefined; implementations may raise an error. $ref(8.2.3.1): a URI-reference resolved against the current base URI; this resolution is safe at load time; other keywords may sit beside it. A resolved URI is an identifier, not necessarily a locator, and no network fetch should be assumed.$dynamicRef(8.2.3.2): resolved as$reffirst; if the resulting fragment was created by$dynamicAnchor, the URI is replaced by that of the outermost resource in the dynamic scope that defines an identically named$dynamicAnchor; otherwise it behaves as$ref.$defs(8.2.4): an object of schemas with no direct effect on validation.$comment(8.3): a string that must not be shown to end users or collected as an annotation, and may be stripped at any point.- Initial base URI (9.1.1): that of RFC 3986 section 5.1 (the retrieval URI), an implementation-specific default if no source is known (documenting it is recommended), or the rules of the host media type for an embedded schema; unless the root has
$id, this is the canonical URI of the root resource. - Loading (9.1.2, 9.1.3): implementations should know ahead of time which schemas they use; a schema may have several URIs but a URI identifies only one schema, and two schemas claiming one URI should raise an error. A document is a meta-schema when it is examined because another schema's
$schemanamed it, so a self-describing meta-schema is processed twice, once as schema and once as meta-schema. - Dereferencing (9.2): resolve the value against the base URI; if it names a schema in this document or another made available, use it. The core spec's own example: with
"$id": "https://example.net/root.json"and"$anchor": "item",#itemresolves tohttps://example.net/root.json#itemandother.jsontohttps://example.net/other.json. - JSON Pointer fragments and embedded resources (9.2.1): an embedded resource can be addressed by a pointer relative to its own canonical URI or any containing resource's; the latter stop being valid if the resource is moved to its own document, so they should not be used. In the spec's example,
https://example.com/foo#/itemspoints to a resource whose canonical URI ishttps://example.com/bar, andfoo#/items/additionalPropertiesis the same object asbar#/additionalProperties. Implementations may refuse non-canonical bases. - Compound documents (9.3): bundled resources must each have an absolute-recommended
$idand should have$schema; bundled resources go in$defsof the root by recommendation, must not replace the referring object or be wrapped in applicators, and existing references must not change. A resource without$schemauses its enclosing resource's dialect. Compound documents should not be validated as one instance; each resource is validated against its own meta-schema. - Caveats (9.4): infinite recursion (two schemas whose
allOfrefer to each other) is undefined; a$reftarget inside an unrecognised keyword structure, or inside a known keyword whose value is not a schema, is undefined. - Hypermedia use (9.5): instances should link to a schema with the
describedbyrelation (for exampleLink: <https://example.com/my-hyper-schema>; rel="describedby"); servers should set long-lived caching headers on schemas; clients should observe them, send a specificUser-Agentand be able to sendFrom.
The format attribute in every draft
From the validation specification of each draft (downloaded 2026-11-13). In every draft a format applies to strings; an instance of another type passes.
| Format | Draft 4 | Draft 6 | Draft 7 | 2019-09 and 2020-12 |
|---|---|---|---|---|
date-time | RFC 3339 section 5.6 | RFC 3339 section 5.6, production date-time | ||
date, time | – | – | productions full-date, full-time | same; if full-date or full-time is implemented, the short form must be too and must behave identically |
duration | – | – | – | the ISO 8601 ABNF in Appendix A of RFC 3339 |
email | RFC 5322 section 3.4.1 | 2019-09: RFC 5322 section 3.4.1; 2020-12: the “Mailbox” rule of RFC 5321 section 4.1.2 | ||
idn-email | – | – | RFC 6531 (2020-12: the extended “Mailbox” rule, section 3.3) | |
hostname | RFC 1034 section 3.1 | RFC 1034 section 3.1 including Punycode hosts (RFC 5891 section 4.4) | 2019-09: RFC 1123 section 2.1 with Punycode; 2020-12: the same | |
idn-hostname | – | – | RFC 1123 hostname, or an internationalised one per RFC 5890 section 2.3.2.3 (draft 7: RFC 1034 as the base) | |
ipv4 | “dotted-quad” ABNF of RFC 2673 section 3.2 | |||
ipv6 | RFC 2373 section 2.2 | RFC 4291 section 2.2 | ||
uri | RFC 3986 | |||
uri-reference | – | URI or relative-reference, RFC 3986 | ||
iri, iri-reference | – | – | RFC 3987 | |
uuid | – | – | – | RFC 4122 plain UUID string, not a URN (use uri with pattern: ^urn:uuid: for URNs) |
uri-template | – | RFC 6570, any level | ||
json-pointer | – | RFC 6901 | RFC 6901 section 5 | RFC 6901 section 5 |
relative-json-pointer | – | – | Relative JSON Pointer (use anyOf or oneOf to accept both forms) | |
regex | – | – | ECMA-262 dialect; validators must accept at least the interoperable subset the specification defines and should accept all valid ECMA-262 expressions | |
- Drafts 4 and 6: implementations may support
format; if so they should validate the attributes and should offer an option to disable validation; custom attributes may be added, and authors may not expect peers to support them. Draft 4 lists date-time, email, hostname, ipv4, ipv6 and uri; draft 6 adds uri-reference, uri-template and json-pointer. - Draft 7:
formatis both an annotation and an assertion; validation is optional, should cover the listed attributes, and should be switchable. A custom format may be added. - 2019-09:
formatis its own vocabulary (.../vocab/format), by default declaredfalse. As an annotation its value must always be collected (known and unknown attributes alike). As an assertion, an implementation that can evaluate it must offer an option to enable or disable it; with the vocabulary declared false it must not assert unless configured to, should give best-effort validation and may make any attribute a no-op; declared true, it must assert unless configured off and must implement syntactic validation of every defined attribute such that some instance values fail. An unknown format must not fail validation. - 2020-12: two vocabularies. Format-Annotation (support required): annotation always; assertion only through an option that is off by default. Format-Assertion (support optional): with value
truethe implementation must fully validate every defined format and refuse schemas it cannot; it still collects the annotation; it must fail on unknown formats. Declaring both equals declaring Format-Assertion only. Custom formats are allowed; defining a keyword in a custom vocabulary is recommended over a new format.
JSON Hyper-Schema vocabulary
Hyper-Schema is a separate specification. This section follows the 2019-09 text (draft-handrews-json-schema-hyperschema-02), the draft 7 text (hyperschema-01), and the meta-schemas hyper-schema, meta/hyper-schema and links, all downloaded 2026-11-13. Its vocabulary URI is https://json-schema.org/draft/2019-09/vocab/hyper-schema; the convenience meta-schema https://json-schema.org/draft/2019-09/hyper-schema combines it with the six standard vocabularies ($recursiveAnchor: true, format declared false); and the link description format can be used alone through https://json-schema.org/draft/2019-09/links. The recommended output format has the schema https://json-schema.org/draft/2019-09/output/hyper-schema. json-schema.org also serves 2020-12 meta-schemas https://json-schema.org/draft/2020-12/hyper-schema, .../meta/hyper-schema and .../links; they are the 2019-09 ones rebuilt on 2020-12: $dynamicAnchor: meta instead of $recursiveAnchor, the seven 2020-12 vocabularies plus the 2019-09 URI https://json-schema.org/draft/2019-09/vocab/hyper-schema (true) in $vocabulary, schema-valued LDO keywords use $dynamicRef: .../2020-12/hyper-schema#meta with the same defaults (false, true, true, true), and the LDO schema is a flat type: object with required: [rel, href]. The keywords are the same. No 2020-12 Hyper-Schema specification text was found (the core text only mentions hyper-schema in passing), so the semantics given here are those of the 2019-09 text.
Schema keywords
base: a URI Template (string,format: uri-template), resolved first as a template and then as a URI Reference against the current URI base; the result is the new base for the subschema holdingbaseand everything inside it. When resolving it forhreforanchor, resolution starts at the attachment point of that keyword, not ofbase.links: an array of Link Description Objects. Links from all schemas applicable to a position are combined into one set, each keeping its own applicablebasevalues in resolution order. The minimal hyper-schema is the empty object.
Link Description Object
It must be an object with href and rel present (the links meta-schema: allOf [{required: [rel, href]}, noRequiredFields]). Target attributes are advisory only; run-time behaviour of the target wins.
| Keyword | Value | Meaning |
|---|---|---|
anchor | string, uri-template | Sets the context URI; resolved like href but hrefSchema never applies and no user input is accepted. |
anchorPointer | string, json-pointer or relative-json-pointer | Moves the context within the instance (needed because application/json has no fragment syntax). Result should be a fragment if the media type allows, else a string-encoded JSON Pointer. |
rel | 2019-09: a string, or an array of at least one string. Draft 7: a string. | A link relation type of RFC 8288 section 2.1 (2019-09 adds that no semantics may be inferred from the presence of another relation). Required. For output, multiple relations are treated as separate LDOs. |
href | string, uri-template | Template for the target URI, resolved as a URI-reference against the base. Required. |
templatePointers | object of JSON Pointers or Relative JSON Pointers | Starting location for a template variable of the same name; relative ones are relative to the attachment point; names not in the template are ignored. |
templateRequired | array of unique strings | Variables that must have a value after resolution, or the link must not be used. |
title, description | strings | For presentation; description gives more detail than the title. |
targetMediaType | string | Expected media type (RFC 2046) or media range (RFC 7231 section 5.3.2); must not be used to interpret the response; assume application/json when nothing else is known. |
targetSchema | hyper-schema; 2019-09 default true | Non-authoritative schema of the target's representation. |
targetHints | anything ({}) | Advisory protocol control data, typically an object with lower-cased header names whose values are arrays (for example {"allow": ["HEAD", "GET", "POST"]}); unknown values must be ignored. |
hrefSchema | hyper-schema; 2019-09 default false | Validates user input for the href template. Omitted or false accepts no input; a false subschema for one variable blocks input for that variable; pre-populated instance data must satisfy all applicable subschemas; the final data set must validate or the link must not be used. |
headerSchema | hyper-schema; 2019-09 default true | Advisory schema for protocol request headers; usually an object with lower-cased names and array values; additionalProperties: false is not recommended and must not stop extra headers. |
submissionMediaType | string, default application/json | Media type of the request payload described by submissionSchema. |
submissionSchema | hyper-schema; 2019-09 default true | Structure of data submitted for processing (distinct from targetSchema). |
$comment | string | As the core keyword. |
In the draft 7 links meta-schema the schema-valued keywords (hrefSchema, targetSchema, headerSchema, submissionSchema) reference http://json-schema.org/draft-07/hyper-schema# and have no default; rel is a plain string. The draft 7 hyper-schema meta-schema is allOf [draft-07 schema] plus $ref # redefinitions of every schema-valued keyword, base and links, and a self link { "rel": "self", "href": "{+%24id}" }; the 2019-09 meta-schemas carry the same self link. Apart from the 2019-09 additions named above (array rel, the relation-inference sentence, the content-negotiation sentence on targetMediaType, the array-values sentence on headerSchema), a line-by-line comparison of the two texts' keyword sections (5 and 6) found no difference in the keywords' rules other than references and wording of cross-links.
Relation types with defined meaning
self: the target is equivalent to the context (RFC 4287 section 4.2.7.2); it must be resolvable from the instance, sohrefSchemamust not be present;templateRequiredshould list what it needs. Aselflink whose context is the whole instance document says how to interact with the resource the document represents.collectionanditem(RFC 6573): the target ofcollectionand the context ofitemare collections; a collection's protocol method for creating a member with a server-assigned URI must not conflict with item creation, andsubmissionSchemashould be compatible with the item representation.- Extension relation types are URIs; use an existing scheme or a non-dereferenceable one such as
tag(RFC 4151); registered relations other thanrelatedare preferred.
Implementation requirements
- The test-suite output format has the fields
contextUri,contextPointer,rel,targetUri,hrefInputTemplates(first entry the partially resolvedhref, then partially resolvedbasevalues from nearest to root),hrefPrepopulatedInput(empty object when nothing is pre-populated) andattachmentPointer; other LDO keywords are copied as they appear. - Links must be findable by attachment pointer or by context pointer; for context pointers, links attached to elements of one array come back in array order.
- URI template resolution (for
base,anchor,href): populate data from the instance, then (only when the initial keyword ishrefandhrefSchemaexists) accept input, then check everytemplateRequiredvariable has a value (else the link is unusable), then string-encode and fill the template by the RFC 6570 algorithm. Variable names are percent-decoded; a variable named intemplatePointersuses that pointer (relative ones resolved against the attachment pointer), otherwise the property of that name at the attachment point (attachmentPointer + "/" + varname). The input step builds a form field for each variable not blocked by afalsesubschema, pre-populated from instance data only if it is valid against every applicable subschema, and the resulting input must validate againsthrefSchema. - String encoding:
true,falseandnullbecome their names; numbers use the best-effort original JSON text (any reasonable form where the original is lost; the input string if input was a string); everything else is RFC 3986 percent-encoded. - Implementations must expose the target attributes, the input schemas and the relation type, may omit URI-construction keywords, should pass unrecognised keywords to the user agent, and should give access to the information for any valid request; requests carrying the target representation use
targetSchemaandtargetMediaType, other payloads usesubmissionSchemaandsubmissionMediaType. Responses must link their own hyper-schema. Streaming parsers may return non-authoritative answers but must offer a blocking authoritative mode. - HTTP (section 8): define one LDO per target and relation pair;
targetSchemahints the response to GET, anything with a matchingContent-Locationand the body of PUT; for PATCH the request is the combination oftargetSchemaand the media type inAccept-Patch; POST usessubmissionSchema(and may advertiseAccept-PostintargetHints);targetHintsshould cover method allowance, method-specific request media types and authentication challenges;headerSchemashould cover content negotiation, authentication, range requests andPrefer; cache and conditional headers are not worth describing; creating a resource means POSTing its representation to its collection.