Looking to master JSON Schema for OpenAPI?

A 9+ hour course taught by a member of the JSON Schema Technical Steering Committee

example : Any

example

Any

Declares a single example of an instance that this schema describes, superseded by the examples keyword.

Value This keyword must be set to any value Hint: Use the jsonschema metaschema and jsonschema lint commands to catch keywords set to invalid values
Kind Other
Applies To Any
Base Dialect 2020-12
Changed In None
Introduced In OpenAPI 3.1
Vocabulary OpenAPI 3.2
Specification https://spec.openapis.org/oas/v3.2.1.html#schema-example
Metaschema https://spec.openapis.org/oas/3.2/meta/2026-02-26
Official Tests None
Default None
Annotation None
Affected By None
Affects None
Also See

The example keyword declares a single example instance for the schema it occurs in, typically for documentation purposes. This keyword does not affect validation and is not an annotation.

Examples

A schema that constrains string instances and declares an example Schema
{
  "$schema": "https://spec.openapis.org/oas/3.2/dialect/2026-02-26",
  "type": "string",
  "example": "John Doe"
}
Valid A string value is valid, and the declared example plays no part in the outcome Instance
"Jane Doe"
Invalid A non-string value is invalid Instance
42
A schema that declares an example contradicting its own constraints Schema
{
  "$schema": "https://spec.openapis.org/oas/3.2/dialect/2026-02-26",
  "type": "string",
  "example": 42
}
Valid A string value is valid, as this keyword is never evaluated against the instance Instance
"Jane Doe"