Page Summary
-
The
typeandformatproperties are used to determine the data type of properties in JSON requests and responses. -
The
typeproperty indicates the JSON data type, while theformatproperty provides additional, more specific type information. -
Some data types that cannot be directly represented in JSON, like 64-bit integers, are represented as a
stringtypewith a specificformatvalue. -
The Google APIs Discovery Service supports a list of
typeandformatvalues, including those defined in the JSON Schema spec and some Google-specific ones.
The type
and format
properties on parameters and schemas can be used
to determine the data type of the property. The type
property indicates the type of
the property when its sent in JSON requests and responses (JSON supports a small set of data
types, see json.org
for details). The format
property provides additional information about the underlying type. Properties will always have
a type
property, but some may also have a format
property.
For example, a 64-bit integer cannot be represented in JSON (since JavaScript and JSON support
integers up to 2^53). Therefore, a 64-bit integer must be represented as a string in JSON
requests/responses. So the type
property will be set to "string", but the format
property will be set to "int64" to indicate that it is a 64-bit integer.
The JSON Schema spec already defines a set of common
values
for the format
property. The Google APIs Discovery Service supports some
of these values, and defines others as well. The full list of type
and format
values supported by Google APIs Discovery Service is summarized below.
string
|
uint64
|
A 64-bit unsigned integer. It has a minimum value of 0 and a maximum value of (2^64)-1 (inclusive). |
|---|

