Schema

Schema is used to define the format of input/output data. Represents a select subset of anOpenAPI 3.0 schema object. More fields may be added in the future as needed.

Fields
typeenum (Type)

Optional. The type of the data.

formatstring

Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc

titlestring

Optional. The title of the Schema.

descriptionstring

Optional. The description of the data.

nullableboolean

Optional. Indicates if the value may be null.

defaultvalue (Value format)

Optional. Default value of the data.

itemsobject (Schema)

Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of type.ARRAY.

minItemsstring (int64 format)

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

maxItemsstring (int64 format)

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

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"]}

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

Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of type.OBJECT.

propertyOrdering[]string

Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.

required[]string

Optional. Required properties of type.OBJECT.

minPropertiesstring (int64 format)

Optional. Minimum number of the properties for type.OBJECT.

maxPropertiesstring (int64 format)

Optional. Maximum number of the properties for type.OBJECT.

minimumnumber

Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the type.INTEGER and type.NUMBER

maximumnumber

Optional. Maximum value of the type.INTEGER and type.NUMBER

minLengthstring (int64 format)

Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the type.STRING

maxLengthstring (int64 format)

Optional. Maximum length of the type.STRING

patternstring

Optional. Pattern of the type.STRING to restrict a string to a regular expression.

examplevalue (Value format)

Optional. Example of the object. Will only populated when the object is the root.

anyOf[]object (Schema)

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

additionalPropertiesvalue (Value format)

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

refstring

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

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. A map of definitions for use byref Only allowed at the root of the schema.

JSON representation
{"type":enum (Type),"format":string,"title":string,"description":string,"nullable":boolean,"default":value,"items":{object (Schema)},"minItems":string,"maxItems":string,"enum":[string],"properties":{string:{object (Schema)},...},"propertyOrdering":[string],"required":[string],"minProperties":string,"maxProperties":string,"minimum":number,"maximum":number,"minLength":string,"maxLength":string,"pattern":string,"example":value,"anyOf":[{object (Schema)}],"additionalProperties":value,"ref":string,"defs":{string:{object (Schema)},...}}

Type

type contains the list of OpenAPI data types as defined byhttps://swagger.io/docs/specification/data-models/data-types/

Enums
TYPE_UNSPECIFIEDNot specified, should not be used.
STRINGOpenAPI string type
NUMBEROpenAPI number type
INTEGEROpenAPI integer type
BOOLEANOpenAPI boolean type
ARRAYOpenAPI array type
OBJECTOpenAPI object type
NULLNull 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 2025-09-25 UTC.