Proto2 vs. Proto3

The Proto2 and Proto3 syntaxes are quite similar, but have some distinct differences. To begin this comparison, I’m going to highlight some of the features of Proto2 that are not present in Proto3. These features include, but are not limited to:

  1. Required message fields. This can be useful for things like SOW keys.
  2. Ability to set custom default values for a field.
  3. Ability to determine if a missing field was not included, or was assigned the default value. This is needed for AMPS to use delta messaging.
  4. Support for nested groups.

The Proto3 syntax contains the addition of many new features that were not present in the Proto2 syntax, as well as the removal of some existing features. These changes include:

  1. Removal of required fields.
  2. Removal of default values. Primitive fields set to a default value are not serialized.
  3. Addition of JSON encoding instead of binary protobuf encoding.
  4. Extensions have been replaced by the Any type.
  5. Addition of well-known type protos. These include any.proto, timestamp.proto, duration.proto, etc.
  6. Strict UTF-8 checking is enforced.

 

http://www.crankuptheamps.com/blog/posts/2017/10/12/protobuf-battle-of-the-syntaxes/

https://github.com/google/protobuf/releases/tag/v3.0.0

https://superlc320.gitbooks.io/protocol-buffers-3-study-notes/content/proto3he_proto2_de_qu_bie.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s