Behavior compatibility
If you follow the practice of only adding things, maintaining ABI/API compatibility and wire compatibility is fairly straightforward. However, this alone isn’t sufficient to ensure your existing client’s expected behavior is maintained.
There are a number of things you need to be aware of to ensure that the behavior of your service doesn’t change when you add new fields for example. Let’s take a look at a few common scenarios.
Default values for new fields
Any new fields added to protobuf messages will be given a default value that’s specific to the type. For example, a new int32
field will have a value of 0
, a string will have ""
, and a message field will be nil
(or the language equivalent).
For a full list of the default values for each field type, see the protobuf docs at https://developers.google.com/protocol-buffers/docs/proto3#default.
This is the standard behavior for proto3. Working against the protocol can...