Schema

Represents a select subset of an OpenAPI 3.0 schema object.

JSON representation
{
  "type": enum (Schema.Type),
  "properties": {
    string: {
      object (Schema)
    },
    ...
  },
  "required": [
    string
  ],
  "description": string,
  "items": {
    object (Schema)
  },
  "nullable": boolean,
  "uniqueItems": boolean,
  "prefixItems": [
    {
      object (Schema)
    }
  ],
  "additionalProperties": {
    object (Schema)
  },
  "anyOf": [
    {
      object (Schema)
    }
  ],
  "enum": [
    string
  ],
  "default": value,
  "ref": string,
  "defs": {
    string: {
      object (Schema)
    },
    ...
  },
  "title": string,
  "minItems": string,
  "maxItems": string,
  "minimum": number,
  "maximum": number
}
Fields
type

enum (Schema.Type)

Required. The type of the data.

properties

map (key: string, value: object (Schema))

Optional. Properties of Type.OBJECT.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

required[]

string

Optional. Required properties of Type.OBJECT.

description

string

Optional. The description of the data.

items

object (Schema)

Optional. Schema of the elements of Type.ARRAY.

nullable

boolean

Optional. Indicates if the value may be null.

uniqueItems

boolean

Optional. Indicate the items in the array must be unique. Only applies to TYPE.ARRAY.

prefixItems[]

object (Schema)

Optional. Schemas of initial elements of Type.ARRAY.

additionalProperties

object (Schema)

Optional. Can either be a boolean or an object, controls the presence of additional properties.

anyOf[]

object (Schema)

Optional. The value should be validated against any (one or more) of the subschemas in the list.

enum[]

string

Optional. Possible values of the element of primitive type with enum format. Examples: 1. We can define direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]} 2. We can define apartment number as : {type:INTEGER, format:enum, enum:["101", "201", "301"]}

default

value (Value format)

Optional. Default value of the data.

ref

string

Optional. Allows indirect references between schema nodes. The value should be a valid reference to a child of the root defs.

For example, the following schema defines a reference to a schema node named "Pet":

type: object properties: pet: ref: #/defs/Pet defs: Pet: type: object properties: name: type: string

The value of the "pet" property is a reference to the schema node named "Pet". See details in https://json-schema.org/understanding-json-schema/structuring.

defs

map (key: string, value: object (Schema))

Optional. A map of definitions for use by ref. Only allowed at the root of the schema.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

title

string

Optional. The title of the schema.

minItems

string (int64 format)

Optional. Minimum number of the elements for Type.ARRAY.

maxItems

string (int64 format)

Optional. Maximum number of the elements for Type.ARRAY.

minimum

number

Optional. Minimum value for Type.INTEGER and Type.NUMBER.

maximum

number

Optional. Maximum value for Type.INTEGER and Type.NUMBER.

Schema.Type

OpenAPI data types.

Enums
TYPE_UNSPECIFIED Type unspecified.
STRING String type.
INTEGER Integer type.
NUMBER Number type.
BOOLEAN Boolean type.
OBJECT Object type.
ARRAY Array type.