Interface Schema

Schema is used to define the format of input/output data.

Represents a select subset of an OpenAPI 3.0 schema object. More fields may be added in the future as needed.

interface Schema {
    anyOf?: Schema[];
    default?: unknown;
    description?: string;
    enum?: string[];
    example?: unknown;
    format?: string;
    items?: Schema;
    maximum?: number;
    maxItems?: string;
    maxLength?: string;
    maxProperties?: string;
    minimum?: number;
    minItems?: string;
    minLength?: string;
    minProperties?: string;
    nullable?: boolean;
    pattern?: string;
    properties?: Record<string, Schema>;
    propertyOrdering?: string[];
    required?: string[];
    title?: string;
    type?: Type;
}

Properties

anyOf?: Schema[]

Optional. The instance must be valid against any (one or more) of the subschemas listed in any_of.

default?: unknown

Optional. Default value to use if the field is not specified.

description?: string

Optional. Description of the schema.

enum?: string[]

Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set format to enum and provide the list of possible values in enum. For example: 1. To define directions: {type:STRING, format:enum, enum:["EAST", "NORTH", "SOUTH", "WEST"]} 2. To define apartment numbers: {type:INTEGER, format:enum, enum:["101", "201", "301"]}

example?: unknown

Optional. Example of an instance of this schema.

format?: string

Optional. The format of the data. For NUMBER type, format can be float or double. For INTEGER type, format can be int32 or int64. For STRING type, format can be email, byte, date, date-time, password, and other formats to further refine the data type.

items?: Schema

Optional. If type is ARRAY, items specifies the schema of elements in the array.

maximum?: number

Optional. If type is INTEGER or NUMBER, maximum specifies the maximum allowed value.

maxItems?: string

Optional. If type is ARRAY, max_items specifies the maximum number of items in an array.

maxLength?: string

Optional. If type is STRING, max_length specifies the maximum length of the string.

maxProperties?: string

Optional. If type is OBJECT, max_properties specifies the maximum number of properties that can be provided.

minimum?: number

Optional. If type is INTEGER or NUMBER, minimum specifies the minimum allowed value.

minItems?: string

Optional. If type is ARRAY, min_items specifies the minimum number of items in an array.

minLength?: string

Optional. If type is STRING, min_length specifies the minimum length of the string.

minProperties?: string

Optional. If type is OBJECT, min_properties specifies the minimum number of properties that can be provided.

nullable?: boolean

Optional. Indicates if the value of this field can be null.

pattern?: string

Optional. If type is STRING, pattern specifies a regular expression that the string must match.

properties?: Record<string, Schema>

Optional. If type is OBJECT, properties is a map of property names to schema definitions for each property of the object.

propertyOrdering?: string[]

Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties.

required?: string[]

Optional. If type is OBJECT, required lists the names of properties that must be present.

title?: string

Optional. Title for the schema.

type?: Type

Optional. Data type of the schema field.