Extension Field Registry
x-jsonschema-contains - The JSON Schema contains subschema for array elements, used when targeting OpenAPI versions that do not directly support it.
JSON Schema draft-06 introduced the contains keyword to describe a subschema that at least one array element should match.
The x-jsonschema-contains extension mirrors this JSON Schema keyword when targeting OpenAPI versions where the keyword is not directly available, serializing it as x-jsonschema-contains.
Use this extension only with JSON Schema versions before draft-06; draft-06 and later define contains directly.
It can appear as a property in the following objects: ["Schema Object"].
Used by: (informational)
- Microsoft.OpenApi (.NET OpenAPI library)
Schema
{"$ref"=>"#/$defs/schemaObject"}
Example
openapi: 3.0.4
info:
title: My API
version: 1.0.0
paths: {}
components:
schemas:
Roles:
type: array
items:
type: string
x-jsonschema-contains:
const: admin