Defines the schema of input and output data. This is a subset of the OpenAPI 3.0 Schema Object .
type
enum ( Type
)
Optional. data type of the schema field.
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.
title
string
Optional. title for the schema.
description
string
Optional. description of the schema.
nullable
boolean
Optional. Indicates if the value of this field can be null.
default
value ( Value
format)
Optional. Default value to use if the field is not specified.
items
object ( Schema
)
Optional. If type is ARRAY
, items
specifies the schema of elements in the array.
minItems
string ( int64
format)
Optional. If type is ARRAY
, minItems
specifies the minimum number of items in an array.
maxItems
string ( int64
format)
Optional. If type is ARRAY
, maxItems
specifies the maximum number of items in an array.
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"]}
properties
map (key: string, value: object ( 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.
minProperties
string ( int64
format)
Optional. If type is OBJECT
, minProperties
specifies the minimum number of properties that can be provided.
maxProperties
string ( int64
format)
Optional. If type is OBJECT
, maxProperties
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.
maximum
number
Optional. If type is INTEGER
or NUMBER
, maximum
specifies the maximum allowed value.
minLength
string ( int64
format)
Optional. If type is STRING
, minLength
specifies the minimum length of the string.
maxLength
string ( int64
format)
Optional. If type is STRING
, maxLength
specifies the maximum length of the string.
pattern
string
Optional. If type is STRING
, pattern
specifies a regular expression that the string must match.
example
value ( Value
format)
Optional. Example of an instance of this schema.
anyOf[]
object ( Schema
)
Optional. The instance must be valid against any (one or more) of the subschemas listed in anyOf
.
additionalProperties
value ( Value
format)
Optional. If type
is OBJECT
, specifies how to handle properties not defined in properties
. If it is a boolean false
, no additional properties are allowed. If it is a schema, additional properties are allowed if they conform to the schema.
ref
string
Optional. Allows referencing another schema definition to use in place of this schema. The value must be a valid reference to a schema in 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. defs
provides a map of schema definitions that can be reused by ref
elsewhere in the schema. Only allowed at root level of the schema.
| JSON representation |
|---|
{ "type" : enum ( |
Type
type contains the list of OpenAPI data types as defined by https://swagger.io/docs/specification/data-models/data-types/
| Enums | |
|---|---|
TYPE_UNSPECIFIED
|
Not specified, should not be used. |
STRING
|
OpenAPI string type |
NUMBER
|
OpenAPI number type |
INTEGER
|
OpenAPI integer type |
BOOLEAN
|
OpenAPI boolean type |
ARRAY
|
OpenAPI array type |
OBJECT
|
OpenAPI object type |
NULL
|
Null type |

