Schema Stay organized with collections Save and categorize content based on your preferences.
Defines the schema of input and output data. This is a subset of theOpenAPI 3.0 Schema Object.
typeenum (Type)Optional. data type of the schema field.
formatstringOptional. The format of the data. ForNUMBER type, format can befloat ordouble. ForINTEGER type, format can beint32 orint64. ForSTRING type, format can beemail,byte,date,date-time,password, and other formats to further refine the data type.
titlestringOptional. title for the schema.
descriptionstringOptional. description of the schema.
nullablebooleanOptional. Indicates if the value of this field can be null.
defaultvalue (Value format)Optional. Default value to use if the field is not specified.
itemsobject (Schema)Optional. If type isARRAY,items specifies the schema of elements in the array.
minItemsstring (int64 format)Optional. If type isARRAY,minItems specifies the minimum number of items in an array.
maxItemsstring (int64 format)Optional. If type isARRAY,maxItems specifies the maximum number of items in an array.
enum[]stringOptional. 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, setformat toenum and provide the list of possible values inenum. 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"]}
propertiesmap (key: string, value: object (Schema))Optional. If type isOBJECT,properties is a map of property names to schema definitions for each property of the object.
propertyOrdering[]stringOptional. 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[]stringOptional. If type isOBJECT,required lists the names of properties that must be present.
minPropertiesstring (int64 format)Optional. If type isOBJECT,minProperties specifies the minimum number of properties that can be provided.
maxPropertiesstring (int64 format)Optional. If type isOBJECT,maxProperties specifies the maximum number of properties that can be provided.
minimumnumberOptional. If type isINTEGER orNUMBER,minimum specifies the minimum allowed value.
maximumnumberOptional. If type isINTEGER orNUMBER,maximum specifies the maximum allowed value.
minLengthstring (int64 format)Optional. If type isSTRING,minLength specifies the minimum length of the string.
maxLengthstring (int64 format)Optional. If type isSTRING,maxLength specifies the maximum length of the string.
patternstringOptional. If type isSTRING,pattern specifies a regular expression that the string must match.
examplevalue (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 inanyOf.
additionalPropertiesvalue (Value format)Optional. Iftype isOBJECT, specifies how to handle properties not defined inproperties. If it is a booleanfalse, no additional properties are allowed. If it is a schema, additional properties are allowed if they conform to the schema.
refstringOptional. Allows referencing another schema definition to use in place of this schema. The value must be a valid reference to a schema indefs.
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 inhttps://json-schema.org/understanding-json-schema/structuring
defsmap (key: string, value: object (Schema))Optional.defs provides a map of schema definitions that can be reused byref 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 byhttps://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 |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-29 UTC.