If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field value which holds the custom JSON in addition to the @type field. Example (for message google.protobuf.Duration):

A URL/resource name whose content describes the type of the serialized message.

For URLs which use the schema http, https, or no schema, the following restrictions and interpretations apply:

If no schema is provided, https is assumed.

The last segment of the URL's path must represent the fully qualified name of the type (as in path/google.protobuf.Duration).

An HTTP GET on the URL must yield a google.protobuf.Type value in binary format, or produce an error.

Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.)

Schemas other than http, https (or the empty schema) might be used with implementation specific semantics.

value

bytes

Must be valid serialized data of the above specified type.

Api

Api is a light-weight descriptor for a protocol buffer service.

Field name

Type

Description

name

string

The fully qualified name of this api, including package name followed by the api's simple name.

A version string for this api. If specified, must have the form major-version.minor-version, as in 1.10. If the minor version is omitted, it defaults to zero. If the entire version field is empty, the major version is derived from the package name, as outlined below. If the field is not empty, the version in the package name will be verified to be consistent with what is provided here.

The versioning schema uses semantic versioning where the major version number indicates a breaking change and the minor version an additive, non-breaking change. Both version numbers are signals to users what to expect from different versions, and should be carefully chosen based on the product plan.

The major version is also reflected in the package name of the API, which must end in v<major-version>, as in google.feature.v1. For major versions 0 and 1, the suffix can be omitted. Zero major versions must only be used for experimental, none-GA apis.

BytesValue

DoubleValue

Wrapper message for double.

The JSON representation for DoubleValue is JSON number.

Field name

Type

Description

value

double

The double value.

Duration

A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". It is related to Timestamp in that the difference between two Timestamp values is a Duration and it can be added or subtracted from a Timestamp. Range is approximately +-10,000 years.

Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive.

nanos

int32

Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 seconds field and a positive or negative nanos field. For durations of one second or more, a non-zero value for the nanos field must be of the same sign as the seconds field. Must be from -999,999,999 to +999,999,999 inclusive.

Empty

A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:

The string value of the default value of this field. Proto2 syntax only.

Cardinality

Whether a field is optional, required, or repeated.

Enum value

Description

CARDINALITY_UNKNOWN

For fields with unknown cardinality.

CARDINALITY_OPTIONAL

For optional fields.

CARDINALITY_REQUIRED

For required fields. Proto2 syntax only.

CARDINALITY_REPEATED

For repeated fields.

Kind

Basic field types.

Enum value

Description

TYPE_UNKNOWN

Field type unknown.

TYPE_DOUBLE

Field type double.

TYPE_FLOAT

Field type float.

TYPE_INT64

Field type int64.

TYPE_UINT64

Field type uint64.

TYPE_INT32

Field type int32.

TYPE_FIXED64

Field type fixed64.

TYPE_FIXED32

Field type fixed32.

TYPE_BOOL

Field type bool.

TYPE_STRING

Field type string.

TYPE_GROUP

Field type group. Proto2 syntax only, and deprecated.

TYPE_MESSAGE

Field type message.

TYPE_BYTES

Field type bytes.

TYPE_UINT32

Field type uint32.

TYPE_ENUM

Field type enum.

TYPE_SFIXED32

Field type sfixed32.

TYPE_SFIXED64

Field type sfixed64.

TYPE_SINT32

Field type sint32.

TYPE_SINT64

Field type sint64.

FieldMask

FieldMask represents a set of symbolic field paths, for example:

paths: "f.a"
paths: "f.b.d"

Here f represents a field in some root message, a and b fields in the message found in f, and d a field found in the message in f.b.

Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below).

Field Masks in Projections

When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows:

f {
a : 22
b {
d : 1
x : 2
}
y : 13
}
z: 8

The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output):

f {
a : 22
b {
d : 1
}
}

A repeated field is not allowed except at the last position of a field mask.

If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified).

Note that a field mask does not necessarily applies to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs.

Field Masks in Update Operations

A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask.

In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below.

If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not.

As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API.

Considerations for HTTP REST

The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates).

JSON Encoding of Field Masks

In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions.

The mixin construct implies that all methods in AccessControl are also declared with same name and request/response types in Storage. A documentation generator or annotation processor will see the effective Storage.GetAcl method after inherting documentation and annotations as follows:

SourceContext

SourceContext represents information about the source of a protobuf element, like the file in which it is defined.

Field name

Type

Description

file_name

string

The path-qualified name of the .proto file that contained the associated protobuf element. For example: "google/protobuf/source.proto".

StringValue

Wrapper message for string.

The JSON representation for StringValue is JSON string.

Field name

Type

Description

value

string

The string value.

Struct

Struct represents a structured data value, consisting of fields which map to dynamically typed values. In some languages, Struct might be supported by a native representation. For example, in scripting languages like JS a struct is represented as an object. The details of that representation are described together with the proto support for the language.

Syntax

The syntax in which a protocol buffer element is defined.

Enum value

Description

SYNTAX_PROTO2

Syntax proto2.

SYNTAX_PROTO3

Syntax proto3.

Timestamp

A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time. It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from RFC 3339 date strings. See https://www.ietf.org/rfc/rfc3339.txt.

Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.

nanos

int32

Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive.

UInt32Value

UInt64Value

Wrapper message for uint64.

The JSON representation for UInt64Value is JSON string.

Field name

Type

Description

value

uint64

The uint64 value.

Value

Value represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of that variants, absence of any variant indicates an error.