-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Protocol Buffers Handbook
By :

On top of all the scalar types that Protobuf provides as part of the language, it also provides some already-defined types called well-known types (WKTs). All these types can be found in the src/google/protobuf
folder in the GitHub repository (https://github.com/protocolbuffers/protobuf/tree/main/src/google/protobuf), and they are all defined under the google.protobuf
package.
Here is a list of the most common WKTs available:
Duration
Timestamp
FieldMask
Any
Struct
Let’s go through all of these types and see what they are used for.
These two types are pretty interesting because they show us the importance of naming, documenting with comments, and separating definitions into different files for reusability. In fact, these two types have the same definitions except for the message name. Here are the diff
command results between those two (simplified):
-message Timestamp { - // Represents...