Method Name Request / Response Type Description
Capabilities CapabilityRequest
CapabilityResponse

Capabilities allows the client to retrieve the set of capabilities that
is supported by the target. This allows the target to validate the
service version that is implemented and retrieve the set of models that
the target supports. The models can then be specified in subsequent RPCs
to restrict the set of data that is utilized.
Reference: gNMI Specification Section 3.2

Get GetRequest
GetResponse

Retrieve a snapshot of data from the target. A Get RPC requests that the
target snapshots a subset of the data tree as specified by the paths
included in the message and serializes this to be returned to the
client using the specified encoding.
Reference: gNMI Specification Section 3.3

Set SetRequest
SetResponse

Set allows the client to modify the state of data on the target. The
paths to modified along with the new values that the client wishes
to set the value to.
Reference: gNMI Specification Section 3.4

Subscribe SubscribeRequest stream
SubscribeResponse stream

Subscribe allows a client to request the target to send it values
of particular paths within the data tree. These values may be streamed
at a particular cadence (STREAM), sent one off on a long-lived channel
(POLL), or sent as a one-off retrieval (ONCE).
Reference: gNMI Specification Section 3.5

CapabilityRequest

CapabilityRequest is sent by the client in the Capabilities RPC to request
that the target reports its capabilities.
Reference: gNMI Specification Section 3.2.1

Field Type Description
extension (repeated) gnmi_ext.Extension

Extension messages associated with the CapabilityRequest. See the
gNMI extension specification for further definition.

CapabilityResponse

CapabilityResponse is used by the target to report its capabilities to the
client within the Capabilities RPC.
Reference: gNMI Specification Section 3.2.2

Field Type Description
supported_models (repeated) ModelData

Supported schema models.

supported_encodings (repeated) Encoding

Supported encodings.

gNMI_version string

Supported gNMI version.

extension (repeated) gnmi_ext.Extension

Extension messages associated with the CapabilityResponse. See the
gNMI extension specification for further definition.

Decimal64

Decimal64 is used to encode a fixed precision decimal number. The value
is expressed as a set of digits with the precision specifying the
number of digits following the decimal point in the digit set.
This message is deprecated in favor of encoding all floating point types
as double precision.

Field Type Description
digits int64

Set of digits.

precision uint32

Number of digits following the decimal point.

Error

Error message previously utilised to return errors to the client. Deprecated
in favour of using the google.golang.org/genproto/googleapis/rpc/status
message in the RPC response.
Reference: gNMI Specification Section 2.5

Field Type Description
code uint32

Canonical gRPC error code.

message string

Human readable error.

data google.protobuf.Any

Optional additional information.

GetRequest

GetRequest is sent when a client initiates a Get RPC. It is used to specify
the set of data elements for which the target should return a snapshot of
data. The use_models field specifies the set of schema modules that are to
be used by the target - where use_models is not specified then the target
must use all schema models that it has.
Reference: gNMI Specification Section 3.3.1

Field Type Description
prefix Path

Prefix used for paths.

path (repeated) Path

Paths requested by the client.

type GetRequest.DataType

The type of data being requested.

encoding Encoding

Encoding to be used.

use_models (repeated) ModelData

The schema models to be used.

extension (repeated) gnmi_ext.Extension

Extension messages associated with the GetRequest. See the
gNMI extension specification for further definition.

GetResponse

GetResponse is used by the target to respond to a GetRequest from a client.
The set of Notifications corresponds to the data values that are requested
by the client in the GetRequest.
Reference: gNMI Specification Section 3.3.2

Field Type Description
notification (repeated) Notification

Data values.

error Error

Errors that occurred in the Get.

extension (repeated) gnmi_ext.Extension

Extension messages associated with the GetResponse. See the
gNMI extension specification for further definition.

ModelData

ModelData is used to describe a set of schema modules. It can be used in a
CapabilityResponse where a target reports the set of modules that it
supports, and within the SubscribeRequest and GetRequest messages to specify
the set of models from which data tree elements should be reported.
Reference: gNMI Specification Section 3.2.3

Field Type Description
name string

Name of the model.

organization string

Organization publishing the model.

version string

Semantic version of the model.

Notification

Notification is a re-usable message that is used to encode data from the
target to the client. A Notification carries two types of changes to the data
tree:
- Deleted values (delete) - a set of paths that have been removed from the
data tree.
- Updated values (update) - a set of path-value pairs indicating the path
whose value has changed in the data tree.
Reference: gNMI Specification Section 2.1

Field Type Description
timestamp int64

Timestamp in nanoseconds since Epoch.

prefix Path

Prefix used for paths in the message.

update (repeated) Update

Data elements that have changed values.

delete (repeated) Path

Data elements that have been deleted.

atomic bool

This notification contains a set of paths that are always updated together
referenced by a globally unique prefix.

Path

Path encodes a data tree path as a series of repeated strings, with
each element of the path representing a data tree node name and the
associated attributes.
Reference: gNMI Specification Section 2.2.2.

Field Type Description
element (repeated) string

Elements of the path are no longer encoded as a string, but rather within
the elem field as a PathElem message.

origin string

Label to disambiguate path.

elem (repeated) PathElem

Elements of the path.

target string

The name of the target

PathElem

PathElem encodes an element of a gNMI path, along with any attributes (keys)
that may be associated with it.
Reference: gNMI Specification Section 2.2.2.

Field Type Description
name string

The name of the element in the path.

key (repeated) PathElem.KeyEntry

Map of key (attribute) name to value.

Field Type Description
key string

value string

Poll

Poll is sent within a SubscribeRequest to trigger the device to
send telemetry updates for the paths that are associated with the
subscription.
Reference: gNMI Specification Section Section 3.5.1.4

Empty message

QOSMarking

QOSMarking specifies the DSCP value to be set on transmitted telemetry
updates from the target.
Reference: gNMI Specification Section 3.5.1.2

Field Type Description
marking uint32

ScalarArray

ScalarArray is used to encode a mixed-type array of values.

Field Type Description
element (repeated) TypedValue

The set of elements within the array. Each TypedValue message should
specify only elements that have a field identifier of 1-7 (i.e., the
values are scalar values).

SetRequest

SetRequest is sent from a client to the target to update values in the data
tree. Paths are either deleted by the client, or modified by means of being
updated, or replaced. Where a replace is used, unspecified values are
considered to be replaced, whereas when update is used the changes are
considered to be incremental. The set of changes that are specified within
a single SetRequest are considered to be a transaction.
Reference: gNMI Specification Section 3.4.1

Field Type Description
prefix Path

Prefix used for paths in the message.

delete (repeated) Path

Paths to be deleted from the data tree.

replace (repeated) Update

Updates specifying elements to be replaced.

update (repeated) Update

Updates specifying elements to updated.

extension (repeated) gnmi_ext.Extension

Extension messages associated with the SetRequest. See the
gNMI extension specification for further definition.

SetResponse

SetResponse is the response to a SetRequest, sent from the target to the
client. It reports the result of the modifications to the data tree that were
specified by the client. Errors for this RPC should be reported using the
https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto
message in the RPC return. The gnmi.Error message can be used to add
additional details where required. Reference: gNMI Specification
Section 3.4.2

Field Type Description
prefix Path

Prefix used for paths.

response (repeated) UpdateResult

A set of responses specifying the result of the operations specified in
the SetRequest.

message Error

The overall status of the transaction.

timestamp int64

Timestamp of transaction (ns since epoch).

extension (repeated) gnmi_ext.Extension

Extension messages associated with the SetResponse. See the
gNMI extension specification for further definition.

SubscribeRequest

SubscribeRequest is the message sent by the client to the target when
initiating a subscription to a set of paths within the data tree. The
request field must be populated and the initial message must specify a
SubscriptionList to initiate a subscription.
Reference: gNMI Specification Section 3.5.1.1

Field Type Description
request (one of)
subscribe SubscriptionList

Specify the paths within a subscription.

poll Poll

Trigger a polled update.

extension (repeated) gnmi_ext.Extension

Extension messages associated with the SubscribeRequest. See the
gNMI extension specification for further definition.

SubscribeResponse

SubscribeResponse is the message used by the target within a Subscribe RPC.
The target includes a Notification message which is used to transmit values
of the path(s) that are associated with the subscription. The same message
is to indicate that the target has sent all data values once (is
synchronized).
Reference: gNMI Specification Section 3.5.1.4

Field Type Description
response (one of)
update Notification

Changed or sampled value for a path.

sync_response bool

Indicate target has sent all values associated with the subscription
at least once.

error Error

Deprecated in favour of google.golang.org/genproto/googleapis/rpc/status

extension (repeated) gnmi_ext.Extension

Extension messages associated with the SubscribeResponse. See the
gNMI extension specification for further definition.

Subscription

Subscription is a single request within a SubscriptionList. The path
specified is interpreted (along with the prefix) as the elements of the data
tree that the client is subscribing to. The mode determines how the target
should trigger updates to be sent.
Reference: gNMI Specification Section 3.5.1.3

Field Type Description
path Path

The data tree path.

mode SubscriptionMode

Subscription mode to be used.

sample_interval uint64

ns between samples in SAMPLE mode.

suppress_redundant bool

Indicates whether values that have not changed should be sent in a SAMPLE
subscription.

heartbeat_interval uint64

Specifies the maximum allowable silent period in nanoseconds when
suppress_redundant is in use. The target should send a value at least once
in the period specified.

SubscriptionList

SubscriptionList is used within a Subscribe message to specify the list of
paths that the client wishes to subscribe to. The message consists of a
list of (possibly prefixed) paths, and options that relate to the
subscription.
Reference: gNMI Specification Section 3.5.1.2

Field Type Description
prefix Path

Prefix used for paths.

subscription (repeated) Subscription

Set of subscriptions to create.

qos QOSMarking

DSCP marking to be used.

mode SubscriptionList.Mode

allow_aggregation bool

Whether elements of the schema that are marked as eligible for aggregation
should be aggregated or not.

use_models (repeated) ModelData

The set of schemas that define the elements of the data tree that should
be sent by the target.

encoding Encoding

The encoding that the target should use within the Notifications generated
corresponding to the SubscriptionList.

updates_only bool

An optional field to specify that only updates to current state should be
sent to a client. If set, the initial state is not sent to the client but
rather only the sync message followed by any subsequent updates to the
current state. For ONCE and POLL modes, this causes the server to send only
the sync message (Sec. 3.5.2.3).

TypedValue

TypedValue is used to encode a value being sent between the client and
target (originated by either entity).

Field Type Description
value (one of)
string_val string

String value.

int_val int64

Integer value.

uint_val uint64

Unsigned integer value.

bool_val bool

Bool value.

bytes_val bytes

Arbitrary byte sequence value.

float_val float

Deprecated - use double_val.

double_val double

Floating point value.

decimal_val Decimal64

Deprecated - use double_val.

leaflist_val ScalarArray

Mixed type scalar array value.

any_val google.protobuf.Any

protobuf.Any encoded bytes.

json_val bytes

JSON-encoded text.

json_ietf_val bytes

JSON-encoded text per RFC7951.

ascii_val string

Arbitrary ASCII text.

proto_bytes bytes

Protobuf binary encoded bytes. The message type is not included.
See the specification at
github.com/openconfig/reference/blob/master/rpc/gnmi/protobuf-vals.md
for a complete specification. [Experimental]

Update

Update is a re-usable message that is used to store a particular Path,
Value pair.
Reference: gNMI Specification Section 2.1

Field Type Description
path Path

The path (key) for the update.

value Value

The value (value) for the update.

val TypedValue

The explicitly typed update value.

duplicates uint32

Number of coalesced duplicates.

UpdateResult

UpdateResult is used within the SetResponse message to communicate the
result of an operation specified within a SetRequest message.
Reference: gNMI Specification Section 3.4.2

Field Type Description
timestamp int64

Deprecated timestamp for the UpdateResult, this field has been
replaced by the timestamp within the SetResponse message, since
all mutations effected by a set should be applied as a single
transaction.

path Path

Path associated with the update.

message Error

Status of the update operation.

op UpdateResult.Operation

Update operation type.

Value

Value encodes a data tree node's value - along with the way in which
the value is encoded. This message is deprecated by gNMI 0.3.0.
Reference: gNMI Specification Section 2.2.3.

Field Type Description
value bytes

Value of the variable being transmitted.

type Encoding

Encoding used for the value field.

Encoding

Encoding defines the value encoding formats that are supported by the gNMI
protocol. These encodings are used by both the client (when sending Set
messages to modify the state of the target) and the target when serializing
data to be returned to the client (in both Subscribe and Get RPCs).
Reference: gNMI Specification Section 2.3

Name Number Description
JSON 0

JSON encoded text.

BYTES 1

Arbitrarily encoded bytes.

PROTO 2

Encoded according to scalar values of TypedValue.

ASCII 3

ASCII text of an out-of-band agreed format.

JSON_IETF 4

JSON encoded text as per RFC7951.

GetRequest.DataType

Type of elements within the data tree.

Name Number Description
ALL 0

All data elements.

CONFIG 1

Config (rw) only elements.

STATE 2

State (ro) only elements.

OPERATIONAL 3

Data elements marked in the schema as operational. This refers to data
elements whose value relates to the state of processes or interactions
running on the device.

SubscriptionList.Mode

Mode of the subscription.

Name Number Description
STREAM 0

Values streamed by the target (Sec. 3.5.1.5.2).

ONCE 1

Values sent once-off by the target (Sec. 3.5.1.5.1).

POLL 2

Values sent in response to a poll request (Sec. 3.5.1.5.3).

SubscriptionMode

SubscriptionMode is the mode of the subscription, specifying how the
target must return values in a subscription.
Reference: gNMI Specification Section 3.5.1.3

Name Number Description
TARGET_DEFINED 0

The target selects the relevant mode for each element.

ON_CHANGE 1

The target sends an update on element value change.

SAMPLE 2

The target samples values according to the interval.

UpdateResult.Operation

The operation that was associated with the Path specified.

Name Number Description
INVALID 0

DELETE 1

The result relates to a delete of Path.

REPLACE 2

The result relates to a replace of Path.

UPDATE 3

The result relates to an update of Path.

FileOptions.gnmi_service

The gNMI service semantic version.

Extension Type Base Number Description
gnmi_service string .google.protobuf.FileOptions 1001

The gNMI service semantic version.

Extension

The Extension message contains a single gNMI extension.

Field Type Description
ext (one of)
registered_ext RegisteredExtension

A registered extension.

master_arbitration MasterArbitration

Well known extensions.

Master arbitration extension.

history History

History extension.

History

The History extension allows clients to request historical data. Its
spec can be found at
https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-history.md

Field Type Description
request (one of)
snapshot_time int64

Nanoseconds since the epoch

range TimeRange

MasterArbitration

MasterArbitration is used to select the master among multiple gNMI clients
with the same Roles. The client with the largest election_id is honored as
the master.
The document about gNMI master arbitration can be found at
https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-master-arbitration.md

Field Type Description
role Role

election_id Uint128

RegisteredExtension

The RegisteredExtension message defines an extension which is defined outside
of this file.

Field Type Description
id ExtensionID

The unique ID assigned to this extension.

msg bytes

The binary-marshalled protobuf extension payload.

Role

There can be one master for each role. The role is identified by its id.

Field Type Description
id string

More fields can be added if needed, for example, to specify what paths the
role can read/write.

Field Type Description
start int64

Nanoseconds since the epoch

end int64

Nanoseconds since the epoch

Uint128

Representation of unsigned 128-bit integer.

Field Type Description
high uint64

low uint64

ExtensionID

RegisteredExtension is an enumeration acting as a registry for extensions
defined by external sources.

Name Number Description
EID_UNSET 0

New extensions are to be defined within this enumeration - their definition
MUST link to a reference describing their implementation.

EID_EXPERIMENTAL 999

An experimental extension that may be used during prototyping of a new
extension.

Any

`Any` contains an arbitrary serialized protocol buffer message along with a
URL that describes the type of the serialized message.

Protobuf library provides support to pack/unpack Any values in the form
of utility functions or additional generated methods of the Any type.

Example 1: Pack and unpack a message in C++.

Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}

Example 2: Pack and unpack a message in Java.

Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}

Example 3: Pack and unpack a message in Python.

foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
any.Unpack(foo)
...

Example 4: Pack and unpack a message in Go

foo := &pb.Foo{...}
any, err := anypb.New(foo)
if err != nil {
...
}
...
foo := &pb.Foo{}
if err := any.UnmarshalTo(foo); err != nil {
...
}

The pack methods provided by protobuf library will by default use
'type.googleapis.com/full.type.name' as the type URL and the unpack
methods only use the fully qualified type name after the last '/'
in the type URL, for example "foo.bar.com/x/y.z" will yield type
name "y.z".

JSON

The JSON representation of an `Any` value uses the regular
representation of the deserialized, embedded message, with an
additional field `@type` which contains the type URL. Example:

package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}

{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": ,
"lastName":
}

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][]):

{
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}

Field Type Description
type_url string

A URL/resource name that uniquely identifies the type of the serialized
protocol buffer message. This string must contain at least
one "/" character. The last segment of the URL's path must represent
the fully qualified name of the type (as in
`path/google.protobuf.Duration`). The name should be in a canonical form
(e.g., leading "." is not accepted).

In practice, teams usually precompile into the binary all types that they
expect it to use in the context of Any. However, for URLs which use the
scheme `http`, `https`, or no scheme, one can optionally set up a type
server that maps type URLs to message definitions as follows:

* If no scheme is provided, `https` is assumed.
* 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.)

Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with
type.googleapis.com.

Schemes other than `http`, `https` (or the empty scheme) might be
used with implementation specific semantics.

value bytes

Must be a valid serialized protocol buffer of the above specified type.

DescriptorProto

Describes a message type.

Field Type Description
name (optional) string

field (repeated) FieldDescriptorProto

extension (repeated) FieldDescriptorProto

nested_type (repeated) DescriptorProto

enum_type (repeated) EnumDescriptorProto

extension_range (repeated) DescriptorProto.ExtensionRange

oneof_decl (repeated) OneofDescriptorProto

options (optional) MessageOptions

reserved_range (repeated) DescriptorProto.ReservedRange

reserved_name (repeated) string

Reserved field names, which may not be used by fields in the same message.
A given name may only be reserved once.

Field Type Description
start (optional) int32

Inclusive.

end (optional) int32

Exclusive.

options (optional) ExtensionRangeOptions

DescriptorProto.ReservedRange

Range of reserved tag numbers. Reserved tag numbers may not be used by
fields or extension ranges in the same message. Reserved ranges may
not overlap.

Field Type Description
start (optional) int32

Inclusive.

end (optional) int32

Exclusive.

EnumDescriptorProto

Describes an enum type.

Field Type Description
name (optional) string

value (repeated) EnumValueDescriptorProto

options (optional) EnumOptions

reserved_range (repeated) EnumDescriptorProto.EnumReservedRange

Range of reserved numeric values. Reserved numeric values may not be used
by enum values in the same enum declaration. Reserved ranges may not
overlap.

reserved_name (repeated) string

Reserved enum value names, which may not be reused. A given name may only
be reserved once.

EnumDescriptorProto.EnumReservedRange

Range of reserved numeric values. Reserved values may not be used by
entries in the same enum. Reserved ranges may not overlap.

Note that this is distinct from DescriptorProto.ReservedRange in that it
is inclusive such that it can appropriately represent the entire int32
domain.

Field Type Description
start (optional) int32

Inclusive.

end (optional) int32

Inclusive.

Field Type Description
allow_alias (optional) bool

Set this option to true to allow mapping different tag names to the same
value.

deprecated (optional) bool

Is this enum deprecated?
Depending on the target platform, this can emit Deprecated annotations
for the enum, or it will be completely ignored; in the very least, this
is a formalization for deprecating enums.
Default: false

deprecated_legacy_json_field_conflicts (optional) bool

Enable the legacy handling of JSON field name conflicts. This lowercases
and strips underscored from the fields before comparison in proto3 only.
The new behavior takes `json_name` into account and applies to proto2 as
well.
TODO(b/261750190) Remove this legacy behavior once downstream teams have
had time to migrate.

uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here. See above.

EnumValueDescriptorProto

Describes a value within an enum.

Field Type Description
name (optional) string

number (optional) int32

options (optional) EnumValueOptions

Field Type Description
deprecated (optional) bool

Is this enum value deprecated?
Depending on the target platform, this can emit Deprecated annotations
for the enum value, or it will be completely ignored; in the very least,
this is a formalization for deprecating enum values.
Default: false

uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here. See above.

Field Type Description
uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here. See above.

FieldDescriptorProto

Describes a field within a message.

Field Type Description
name (optional) string

number (optional) int32

label (optional) FieldDescriptorProto.Label

type (optional) FieldDescriptorProto.Type

If type_name is set, this need not be set. If both this and type_name
are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.

type_name (optional) string

For message and enum types, this is the name of the type. If the name
starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
rules are used to find the type (i.e. first the nested types within this
message are searched, then within the parent, on up to the root
namespace).

extendee (optional) string

For extensions, this is the name of the type being extended. It is
resolved in the same manner as type_name.

default_value (optional) string

For numeric types, contains the original text representation of the value.
For booleans, "true" or "false".
For strings, contains the default text contents (not escaped in any way).
For bytes, contains the C escaped value. All bytes >= 128 are escaped.

oneof_index (optional) int32

If set, gives the index of a oneof in the containing type's oneof_decl
list. This field is a member of that oneof.

json_name (optional) string

JSON name of this field. The value is set by protocol compiler. If the
user has set a "json_name" option on this field, that option's value
will be used. Otherwise, it's deduced from the field's name by converting
it to camelCase.

options (optional) FieldOptions

proto3_optional (optional) bool

If true, this is a proto3 "optional". When a proto3 field is optional, it
tracks presence regardless of field type.

When proto3_optional is true, this field must be belong to a oneof to
signal to old proto3 clients that presence is tracked for this field. This
oneof is known as a "synthetic" oneof, and this field must be its sole
member (each proto3 optional field gets its own synthetic oneof). Synthetic
oneofs exist in the descriptor only, and do not generate any API. Synthetic
oneofs must be ordered after all "real" oneofs.

For message fields, proto3_optional doesn't create any semantic change,
since non-repeated message fields always track presence. However it still
indicates the semantic detail of whether the user wrote "optional" or not.
This can be useful for round-tripping the .proto file. For consistency we
give message fields a synthetic oneof also, even though it is not required
to track presence. This is especially important because the parser can't
tell if a field is a message or an enum, so it must always create a
synthetic oneof.

Proto2 optional fields do not set this flag, because they already indicate
optional with `LABEL_OPTIONAL`.

Field Type Description
ctype (optional) FieldOptions.CType

The ctype option instructs the C++ code generator to use a different
representation of the field than it normally would. See the specific
options below. This option is not yet implemented in the open source
release -- sorry, we'll try to include it in a future version!
Default: STRING

packed (optional) bool

The packed option can be enabled for repeated primitive fields to enable
a more efficient representation on the wire. Rather than repeatedly
writing the tag and type for each element, the entire array is encoded as
a single length-delimited blob. In proto3, only explicit setting it to
false will avoid using packed encoding.

jstype (optional) FieldOptions.JSType

The jstype option determines the JavaScript type used for values of the
field. The option is permitted only for 64 bit integral and fixed types
(int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
is represented as JavaScript string, which avoids loss of precision that
can happen when a large value is converted to a floating point JavaScript.
Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
use the JavaScript "number" type. The behavior of the default option
JS_NORMAL is implementation dependent.

This option is an enum to permit additional types to be added, e.g.
goog.math.Integer.
Default: JS_NORMAL

lazy (optional) bool

Should this field be parsed lazily? Lazy applies only to message-type
fields. It means that when the outer message is initially parsed, the
inner message's contents will not be parsed but instead stored in encoded
form. The inner message will actually be parsed when it is first accessed.

This is only a hint. Implementations are free to choose whether to use
eager or lazy parsing regardless of the value of this option. However,
setting this option true suggests that the protocol author believes that
using lazy parsing on this field is worth the additional bookkeeping
overhead typically needed to implement it.

This option does not affect the public interface of any generated code;
all method signatures remain the same. Furthermore, thread-safety of the
interface is not affected by this option; const methods remain safe to
call from multiple threads concurrently, while non-const methods continue
to require exclusive access.

Note that implementations may choose not to check required fields within
a lazy sub-message. That is, calling IsInitialized() on the outer message
may return true even if the inner message has missing required fields.
This is necessary because otherwise the inner message would have to be
parsed in order to perform the check, defeating the purpose of lazy
parsing. An implementation which chooses not to check required fields
must be consistent about it. That is, for any particular sub-message, the
implementation must either *always* check its required fields, or *never*
check its required fields, regardless of whether or not the message has
been parsed.

As of May 2022, lazy verifies the contents of the byte stream during
parsing. An invalid byte stream will cause the overall parsing to fail.
Default: false

unverified_lazy (optional) bool

unverified_lazy does no correctness checks on the byte stream. This should
only be used where lazy with verification is prohibitive for performance
reasons.
Default: false

deprecated (optional) bool

Is this field deprecated?
Depending on the target platform, this can emit Deprecated annotations
for accessors, or it will be completely ignored; in the very least, this
is a formalization for deprecating fields.
Default: false

weak (optional) bool

For Google-internal migration only. Do not use. Default: false

debug_redact (optional) bool

Indicate that the field value should not be printed out when using debug
formats, e.g. when the field contains sensitive credentials.
Default: false

retention (optional) FieldOptions.OptionRetention

target (optional) FieldOptions.OptionTargetType

uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here. See above.

FileDescriptorProto

Describes a complete .proto file.

Field Type Description
name (optional) string

file name, relative to root of source tree

package (optional) string

e.g. "foo", "foo.bar", etc.

dependency (repeated) string

Names of files imported by this file.

public_dependency (repeated) int32

Indexes of the public imported files in the dependency list above.

weak_dependency (repeated) int32

Indexes of the weak imported files in the dependency list.
For Google-internal migration only. Do not use.

message_type (repeated) DescriptorProto

All top-level definitions in this file.

enum_type (repeated) EnumDescriptorProto

service (repeated) ServiceDescriptorProto

extension (repeated) FieldDescriptorProto

options (optional) FileOptions

source_code_info (optional) SourceCodeInfo

This field contains optional information about the original source code.
You may safely remove this entire field without harming runtime
functionality of the descriptors -- the information is needed only by
development tools.

syntax (optional) string

The syntax of the proto file.
The supported values are "proto2", "proto3", and "editions".

If `edition` is present, this value must be "editions".

edition (optional) string

The edition of the proto file, which is an opaque string.

FileDescriptorSet

The protocol compiler can output a FileDescriptorSet containing the .proto
files it parses.

Field Type Description
file (repeated) FileDescriptorProto

Field Type Description
java_package (optional) string

Sets the Java package where classes generated from this .proto will be
placed. By default, the proto package is used, but this is often
inappropriate because proto packages do not normally start with backwards
domain names.

java_outer_classname (optional) string

Controls the name of the wrapper Java class generated for the .proto file.
That class will always contain the .proto file's getDescriptor() method as
well as any top-level extensions defined in the .proto file.
If java_multiple_files is disabled, then all the other classes from the
.proto file will be nested inside the single wrapper outer class.

java_multiple_files (optional) bool

If enabled, then the Java code generator will generate a separate .java
file for each top-level message, enum, and service defined in the .proto
file. Thus, these types will *not* be nested inside the wrapper class
named by java_outer_classname. However, the wrapper class will still be
generated to contain the file's getDescriptor() method as well as any
top-level extensions defined in the file.
Default: false

java_generate_equals_and_hash (optional) bool

This option does nothing.

java_string_check_utf8 (optional) bool

If set true, then the Java2 code generator will generate code that
throws an exception whenever an attempt is made to assign a non-UTF-8
byte sequence to a string field.
Message reflection will do the same.
However, an extension field still accepts non-UTF-8 byte sequences.
This option has no effect on when used with the lite runtime.
Default: false

optimize_for (optional) FileOptions.OptimizeMode

Default: SPEED

go_package (optional) string

Sets the Go package where structs generated from this .proto will be
placed. If omitted, the Go package will be derived from the following:
- The basename of the package import path, if provided.
- Otherwise, the package statement in the .proto file, if present.
- Otherwise, the basename of the .proto file, without extension.

cc_generic_services (optional) bool

Should generic services be generated in each language? "Generic" services
are not specific to any particular RPC system. They are generated by the
main code generators in each language (without additional plugins).
Generic services were the only kind of service generation supported by
early versions of google.protobuf.

Generic services are now considered deprecated in favor of using plugins
that generate code specific to your particular RPC system. Therefore,
these default to false. Old code which depends on generic services should
explicitly set them to true.
Default: false

java_generic_services (optional) bool

Default: false

py_generic_services (optional) bool

Default: false

php_generic_services (optional) bool

Default: false

deprecated (optional) bool

Is this file deprecated?
Depending on the target platform, this can emit Deprecated annotations
for everything in the file, or it will be completely ignored; in the very
least, this is a formalization for deprecating files.
Default: false

cc_enable_arenas (optional) bool

Enables the use of arenas for the proto messages in this file. This applies
only to generated classes for C++.
Default: true

objc_class_prefix (optional) string

Sets the objective c class prefix which is prepended to all objective c
generated classes from this .proto. There is no default.

csharp_namespace (optional) string

Namespace for generated classes; defaults to the package.

swift_prefix (optional) string

By default Swift generators will take the proto package and CamelCase it
replacing '.' with underscore and use that to prefix the types/symbols
defined. When this options is provided, they will use this value instead
to prefix the types/symbols defined.

php_class_prefix (optional) string

Sets the php class prefix which is prepended to all php generated classes
from this .proto. Default is empty.

php_namespace (optional) string

Use this option to change the namespace of php generated classes. Default
is empty. When this option is empty, the package name will be used for
determining the namespace.

php_metadata_namespace (optional) string

Use this option to change the namespace of php generated metadata classes.
Default is empty. When this option is empty, the proto file name will be
used for determining the namespace.

ruby_package (optional) string

Use this option to change the package of ruby generated classes. Default
is empty. When this option is not set, the package name will be used for
determining the ruby package.

uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here.
See the documentation for the "Options" section above.

GeneratedCodeInfo

Describes the relationship between generated code and its original source
file. A GeneratedCodeInfo message is associated with only one generated
source file, but may contain references to different source .proto files.

Field Type Description
annotation (repeated) GeneratedCodeInfo.Annotation

An Annotation connects some span of text in generated code to an element
of its generating .proto file.

Field Type Description
path (repeated) int32

Identifies the element in the original source .proto file. This field
is formatted the same as SourceCodeInfo.Location.path.

source_file (optional) string

Identifies the filesystem path to the original source .proto.

begin (optional) int32

Identifies the starting offset in bytes in the generated code
that relates to the identified object.

end (optional) int32

Identifies the ending offset in bytes in the generated code that
relates to the identified object. The end offset should be one past
the last relevant byte (so the length of the text = end - begin).

semantic (optional) GeneratedCodeInfo.Annotation.Semantic

Field Type Description
message_set_wire_format (optional) bool

Set true to use the old proto1 MessageSet wire format for extensions.
This is provided for backwards-compatibility with the MessageSet wire
format. You should not use this for any other reason: It's less
efficient, has fewer features, and is more complicated.

The message must be defined exactly as follows:
message Foo {
option message_set_wire_format = true;
extensions 4 to max;
}
Note that the message cannot have any defined fields; MessageSets only
have extensions.

All extensions of your type must be singular messages; e.g. they cannot
be int32s, enums, or repeated messages.

Because this is an option, the above two restrictions are not enforced by
the protocol compiler.
Default: false

no_standard_descriptor_accessor (optional) bool

Disables the generation of the standard "descriptor()" accessor, which can
conflict with a field of the same name. This is meant to make migration
from proto1 easier; new code should avoid fields named "descriptor".
Default: false

deprecated (optional) bool

Is this message deprecated?
Depending on the target platform, this can emit Deprecated annotations
for the message, or it will be completely ignored; in the very least,
this is a formalization for deprecating messages.
Default: false

map_entry (optional) bool

NOTE: Do not set the option in .proto files. Always use the maps syntax
instead. The option should only be implicitly set by the proto compiler
parser.

Whether the message is an automatically generated map entry type for the
maps field.

For maps fields:
map map_field = 1;
The parsed descriptor looks like:
message MapFieldEntry {
option map_entry = true;
optional KeyType key = 1;
optional ValueType value = 2;
}
repeated MapFieldEntry map_field = 1;

Implementations may choose not to generate the map_entry=true message, but
use a native map in the target language to hold the keys and values.
The reflection APIs in such implementations still need to work as
if the field is a repeated message field.

deprecated_legacy_json_field_conflicts (optional) bool

Enable the legacy handling of JSON field name conflicts. This lowercases
and strips underscored from the fields before comparison in proto3 only.
The new behavior takes `json_name` into account and applies to proto2 as
well.

This should only be used as a temporary measure against broken builds due
to the change in behavior for JSON field name conflicts.

TODO(b/261750190) This is legacy behavior we plan to remove once downstream
teams have had time to migrate.

uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here. See above.

MethodDescriptorProto

Describes a method of a service.

Field Type Description
name (optional) string

input_type (optional) string

Input and output type names. These are resolved in the same way as
FieldDescriptorProto.type_name, but must refer to a message type.

output_type (optional) string

options (optional) MethodOptions

client_streaming (optional) bool

Identifies if client streams multiple client messages Default: false

server_streaming (optional) bool

Identifies if server streams multiple server messages Default: false

Field Type Description
deprecated (optional) bool

Is this method deprecated?
Depending on the target platform, this can emit Deprecated annotations
for the method, or it will be completely ignored; in the very least,
this is a formalization for deprecating methods.
Default: false

idempotency_level (optional) MethodOptions.IdempotencyLevel

Default: IDEMPOTENCY_UNKNOWN

uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here. See above.

OneofDescriptorProto

Describes a oneof.

Field Type Description
name (optional) string

options (optional) OneofOptions

Field Type Description
uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here. See above.

ServiceDescriptorProto

Describes a service.

Field Type Description
name (optional) string

method (repeated) MethodDescriptorProto

options (optional) ServiceOptions

Field Type Description
deprecated (optional) bool

Is this service deprecated?
Depending on the target platform, this can emit Deprecated annotations
for the service, or it will be completely ignored; in the very least,
this is a formalization for deprecating services.
Default: false

uninterpreted_option (repeated) UninterpretedOption

The parser stores options it doesn't recognize here. See above.

SourceCodeInfo

Encapsulates information about the original source file from which a
FileDescriptorProto was generated.

Field Type Description
location (repeated) SourceCodeInfo.Location

A Location identifies a piece of source code in a .proto file which
corresponds to a particular definition. This information is intended
to be useful to IDEs, code indexers, documentation generators, and similar
tools.

For example, say we have a file like:
message Foo {
optional string foo = 1;
}
Let's look at just the field definition:
optional string foo = 1;
^ ^^ ^^ ^ ^^^
a bc de f ghi
We have the following locations:
span path represents
[a,i) [ 4, 0, 2, 0 ] The whole field definition.
[a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
[c,d) [ 4, 0, 2, 0, 5 ] The type (string).
[e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
[g,h) [ 4, 0, 2, 0, 3 ] The number (1).

Notes:
- A location may refer to a repeated field itself (i.e. not to any
particular index within it). This is used whenever a set of elements are
logically enclosed in a single code segment. For example, an entire
extend block (possibly containing multiple extension definitions) will
have an outer location whose path refers to the "extensions" repeated
field without an index.
- Multiple locations may have the same path. This happens when a single
logical declaration is spread out across multiple places. The most
obvious example is the "extend" block again -- there may be multiple
extend blocks in the same scope, each of which will have the same path.
- A location's span is not always a subset of its parent's span. For
example, the "extendee" of an extension declaration appears at the
beginning of the "extend" block and is shared by all extensions within
the block.
- Just because a location's span is a subset of some other location's span
does not mean that it is a descendant. For example, a "group" defines
both a type and a field in a single declaration. Thus, the locations
corresponding to the type and field and their components will overlap.
- Code which tries to interpret locations should probably be designed to
ignore those that it doesn't understand, as more types of locations could
be recorded in the future.

Field Type Description
path (repeated) int32

Identifies which part of the FileDescriptorProto was defined at this
location.

Each element is a field number or an index. They form a path from
the root FileDescriptorProto to the place where the definition occurs.
For example, this path:
[ 4, 3, 2, 7, 1 ]
refers to:
file.message_type(3) // 4, 3
.field(7) // 2, 7
.name() // 1
This is because FileDescriptorProto.message_type has field number 4:
repeated DescriptorProto message_type = 4;
and DescriptorProto.field has field number 2:
repeated FieldDescriptorProto field = 2;
and FieldDescriptorProto.name has field number 1:
optional string name = 1;

Thus, the above path gives the location of a field name. If we removed
the last element:
[ 4, 3, 2, 7 ]
this path refers to the whole field declaration (from the beginning
of the label to the terminating semicolon).

span (repeated) int32

Always has exactly three or four elements: start line, start column,
end line (optional, otherwise assumed same as start line), end column.
These are packed into a single field for efficiency. Note that line
and column numbers are zero-based -- typically you will want to add
1 to each before displaying to a user.

leading_comments (optional) string

If this SourceCodeInfo represents a complete declaration, these are any
comments appearing before and after the declaration which appear to be
attached to the declaration.

A series of line comments appearing on consecutive lines, with no other
tokens appearing on those lines, will be treated as a single comment.

leading_detached_comments will keep paragraphs of comments that appear
before (but not connected to) the current element. Each paragraph,
separated by empty lines, will be one comment element in the repeated
field.

Only the comment content is provided; comment markers (e.g. //) are
stripped out. For block comments, leading whitespace and an asterisk
will be stripped from the beginning of each line other than the first.
Newlines are included in the output.

Examples:

optional int32 foo = 1; // Comment attached to foo.
// Comment attached to bar.
optional int32 bar = 2;

optional string baz = 3;
// Comment attached to baz.
// Another line attached to baz.

// Comment attached to moo.
//
// Another line attached to moo.
optional double moo = 4;

// Detached comment for corge. This is not leading or trailing comments
// to moo or corge because there are blank lines separating it from
// both.

// Detached comment for corge paragraph 2.

optional string corge = 5;
/* Block comment attached
* to corge. Leading asterisks
* will be removed. */
/* Block comment attached to
* grault. */
optional int32 grault = 6;

// ignored detached comments.

trailing_comments (optional) string

leading_detached_comments (repeated) string

UninterpretedOption

A message representing a option the parser does not recognize. This only
appears in options protos created by the compiler::Parser class.
DescriptorPool resolves these when building Descriptor objects. Therefore,
options protos in descriptor objects (e.g. returned by Descriptor::options(),
or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
in them.

Field Type Description
name (repeated) UninterpretedOption.NamePart

identifier_value (optional) string

The value of the uninterpreted option, in whatever type the tokenizer
identified it as during parsing. Exactly one of these should be set.

positive_int_value (optional) uint64

negative_int_value (optional) int64

double_value (optional) double

string_value (optional) bytes

aggregate_value (optional) string

UninterpretedOption.NamePart

The name of the uninterpreted option. Each string represents a segment in
a dot-separated name. is_extension is true iff a segment represents an
extension (denoted with parentheses in options specs in .proto files).
E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
"foo.(bar.baz).moo".

Field Type Description
name_part (required) string

is_extension (required) bool

Proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)

Created by Siva Sivakumar / Roman Dodin / srl-labs