Extension Field Registry

x-jsonschema-minContains - The minimum number of array elements that must match contains, used when targeting OpenAPI versions that do not directly support minContains.

JSON Schema 2019-09 introduced the minContains keyword to set the minimum number of array elements that must match contains.

The x-jsonschema-minContains extension mirrors this JSON Schema keyword when targeting OpenAPI versions where the keyword is not directly available, serializing it as x-jsonschema-minContains.

Use this extension only with JSON Schema versions before 2019-09; 2019-09 and later define minContains directly.

It can appear as a property in the following objects: ["Schema Object"].

Used by: (informational)

Schema

{"type"=>"integer", "minimum"=>0}

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
      x-jsonschema-minContains: 1