a message type
field types
1
2string query
int32 page_numbefield numbers
each field in the message definition has a unique number. These field numbers are used to identify your fields in the message binary format, and should not be changed once your message type is in use.
field rules
singular: a well-formed message can have zero or one of this field(default)
repeated: this field can be repeated any number of times (including zero) in a well-formed message.
1 | /* SearchRequest represents a search query, with pagination options to |
Reserved Fields
1 | message Foo { |
Importing Definitions
1 | import "myproject/other_protos.proto"; |
Move a .proto
file to a new location
1 | // new.proto |
Packages
You can add an optional package
specifier to a .proto
file to prevent name clashes between protocol message types.
1 | package foo.bar; |
You can then use the package specifier when defining fields of your message type:
1 | message Foo { |