Protocol Buffers Pitfall: Adding Enum Values

One of Protocol Buffers (aka protobuf) strengths is its backward and forward compatibility: following some common sense, old protobuf messages types can be read into newer versions of itself, and vice versa. With enums, however, you better be careful. They can break your logic in a surprising way.

Consider you publish an Android app version 1 using this protobuf enum to talk to the cloud:

enum Animal {
    MOUSE = 1;
    CAT = 2;
}

Continue reading Protocol Buffers Pitfall: Adding Enum Values