Supported JSON Schema Keywords
OpenAPI 3.0 uses an extended subset of JSON Schema Specification Wright Draft 00 (aka Draft 5) to describe the data formats. “Extended subset” means that some keywords are supported and some are not, some keywords have slightly different usage than in JSON Schema, and additional keywords are introduced.
Supported Keywords
These keywords have the same meaning as in JSON Schema:
title
pattern
required
enum
minimum
maximum
exclusiveMinimum
exclusiveMaximum
multipleOf
minLength
maxLength
minItems
maxItems
uniqueItems
minProperties
maxProperties
These keywords are supported with minor differences:
type
– the value must be a single type and not an array of types.null
is not supported as a type, use thenullable: true
keyword instead.format
– OpenAPI has its own predefined formats and also allows custom formats.description
– supports CommonMark syntax for rich text representation.items
– must be present iftype
isarray
. The item schema must be an OpenAPI schema and not a standard JSON Schema.properties
– individual property definitions must follow OpenAPI schema rules and not standard JSON Schema.additionalProperties
– the value can be a boolean (true
orfalse
) or an OpenAPI schema.default
– the default value must conform to the specified schema.allOf
– the subschemas must be OpenAPI schemas and not standard JSON Schemas.oneOf
– the subschemas must be OpenAPI schemas and not standard JSON Schemas.anyOf
– the subschemas must be OpenAPI schemas and not standard JSON Schemas.not
– the subschema must be an OpenAPI schema and not a standard JSON Schema.
Unsupported Keywords
$schema
additionalItems
const
contains
dependencies
id
,$id
patternProperties
propertyNames
Additional Keywords
OpenAPI schemas can also use the following keywords that are not part of JSON Schema:
References
JSON Schema Validation – JSON Schema keyword reference
JSON Schema Draft Wright 00 – Core JSON Schema Specification
Did not find what you were looking for? Ask the community
Found a mistake? Let us know