Extension Field Registry
x-jsonschema-examples - The JSON Schema examples annotation for Schema Objects, used when targeting OpenAPI versions that do not directly support it.
JSON Schema draft-06 introduced the examples annotation to provide an array of example values for a schema.
The x-jsonschema-examples extension mirrors this JSON Schema keyword when targeting OpenAPI versions where the keyword is not directly available, serializing it as x-jsonschema-examples.
Use this extension only with JSON Schema versions before draft-06; draft-06 and later define examples directly.
Like the x-jsonschema- namespace, this extension is intended for OpenAPI 3.0 and earlier. When using OpenAPI 3.1 or later, the OpenAPI jsonSchemaDialect field, or JSON Schema’s "$schema" keyword, should be used instead.
It can appear as a property in the following objects: ["Schema Object"].
Used by: (informational)
- Microsoft.OpenApi (.NET OpenAPI library)
Schema
{"type"=>"array", "items"=>{}}
Example
openapi: 3.0.4
info:
title: My API
version: 1.0.0
paths: {}
components:
schemas:
User:
type: object
properties:
id:
type: integer
name:
type: string
x-jsonschema-examples:
- id: 123
name: Ada
- id: 456
name: Grace