API Design · Senior · Question 25 of 75
What are the backward-compatibility rules for Protocol Buffers messages?
- 1Field numbers can be renumbered freely
- ✓Correct answer: Never change or reuse field numbers, add new fields with new numbers, and reserve numbers and names of removed fields
- 3Renaming a field breaks the wire format
Explanation
Protobuf encodes field numbers, not names, so renaming is wire-safe, but renumbering corrupts data between versions.