Interface ParameterSchema

The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the JSON Schema Specification Draft 2020-12.

For more information about the properties, see JSON Schema Core and JSON Schema Validation.

Unless stated otherwise, the property definitions follow those of JSON Schema and do not add any additional semantics. Where JSON Schema indicates that behavior is defined by the application (e.g. for annotations), OAS also defers the definition of semantics to the application consuming the OpenAPI document.

interface ParameterSchema {
    $comment?: string;
    $defs?: {
        [key: string]: JSONSchema7Definition;
    };
    $id?: string;
    $ref?: string;
    $schema?: string;
    additionalItems?: JSONSchema7Definition;
    additionalProperties?: JSONSchema7Definition;
    allOf?: JSONSchema7Definition[];
    anyOf?: JSONSchema7Definition[];
    const?: JSONSchema7Type;
    contains?: JSONSchema7Definition;
    contentEncoding?: string;
    contentMediaType?: string;
    default?: JSONSchema7Type;
    definitions?: {
        [key: string]: JSONSchema7Definition;
    };
    dependencies?: {
        [key: string]: JSONSchema7Definition | string[];
    };
    description?: string;
    discriminator?: DiscriminatorObject;
    else?: JSONSchema7Definition;
    enum?: JSONSchema7Type[];
    example?: any;
    examples?: JSONSchema7Type;
    exclusiveMaximum?: number;
    exclusiveMinimum?: number;
    externalDocs?: ExternalDocumentationObject;
    format?: string;
    if?: JSONSchema7Definition;
    items?: JSONSchema7Definition | JSONSchema7Definition[];
    maxItems?: number;
    maxLength?: number;
    maxProperties?: number;
    maximum?: number;
    minItems?: number;
    minLength?: number;
    minProperties?: number;
    minimum?: number;
    multipleOf?: number;
    not?: JSONSchema7Definition;
    oneOf?: JSONSchema7Definition[];
    pattern?: string;
    patternProperties?: {
        [key: string]: JSONSchema7Definition;
    };
    properties: Record<string, SchemaObject>;
    propertyNames?: JSONSchema7Definition;
    readOnly?: boolean;
    required?: string[];
    then?: JSONSchema7Definition;
    title?: string;
    type?: JSONSchema7TypeName | JSONSchema7TypeName[];
    uniqueItems?: boolean;
    writeOnly?: boolean;
    xml?: XMLObject;
}

Hierarchy (view full)

Properties

$comment?: string
$defs?: {
    [key: string]: JSONSchema7Definition;
}

Type declaration

$id?: string
$ref?: string
$schema?: string
additionalItems?: JSONSchema7Definition
additionalProperties?: JSONSchema7Definition
contentEncoding?: string
contentMediaType?: string
default?: JSONSchema7Type
definitions?: {
    [key: string]: JSONSchema7Definition;
}

Type declaration

dependencies?: {
    [key: string]: JSONSchema7Definition | string[];
}

Type declaration

description?: string

CommonMark syntax MAY be used for rich text representation.

discriminator?: DiscriminatorObject

Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.

example?: any

A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.

Deprecated

The example property has been deprecated in favor of the JSON Schema examples keyword. Use of example is discouraged, and later versions of this specification may remove it.

examples?: JSONSchema7Type
exclusiveMaximum?: number
exclusiveMinimum?: number

Additional external documentation for this schema.

format?: string
maxItems?: number
maxLength?: number
maxProperties?: number
maximum?: number
minItems?: number
minLength?: number
minProperties?: number
minimum?: number
multipleOf?: number
pattern?: string
patternProperties?: {
    [key: string]: JSONSchema7Definition;
}

Type declaration

properties: Record<string, SchemaObject>
propertyNames?: JSONSchema7Definition
readOnly?: boolean
required?: string[]
title?: string
uniqueItems?: boolean
writeOnly?: boolean
xml?: XMLObject

This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.