Protobuf Editions unifies proto2 and proto3, allowing features to be toggled individually rather than through major syntax version upgrades.
Editions allows for smooth migrations and fine-grained control over behaviors:
- Field Presence: whether a reader can tell a field that was never set apart from one set to its default value. Choose
IMPLICIT(the proto3 behavior) orEXPLICIT(the proto2 behavior); the Field Presence page covers the tradeoff. - Enum Type: where a value the enum does not declare ends up.
OPENkeeps it in the field;CLOSEDmoves it to the unknown fields. - Repeated Encoding: Standardize on
PACKED(for efficiency) orEXPANDED(for compatibility).
That granularity is the whole point. Under proto2 and proto3, these behaviors were welded to the single keyword at the top of the file, so migration was all or nothing: moving a file to proto3 opened its closed enums, dropped its custom field defaults, and removed explicit presence from its singular scalars, all at once.
Editions makes each of those a separate feature with a scope of its own, set per file and then narrowed on a message, an enum, or a single field, so a schema can adopt one new behavior without taking the others. New behavior then ships as a new feature with a per-edition default, rather than as a "proto4" that would force the same all-or-nothing migration again.
Three editions have shipped so far, roughly one per year: edition 2023, which unified proto2 and proto3; edition 2024, which added symbol visibility and import option; and edition 2026 (protobuf 36.x), which turns on naming-style enforcement, defaults symbol visibility to strict, and adds custom JSON names for enum values. The editions overview and the feature settings reference track exactly what each edition changes.
edition = "2024"; package demo.v1; // Set for the whole file... option features.enum_type = CLOSED; enum Unit { UNIT_UNSPECIFIED = 0; UNIT_CELSIUS = 1; } enum Status { // ...and overridden on one enum. option features.enum_type = OPEN; STATUS_UNSPECIFIED = 0; STATUS_ACTIVE = 1; }
How the language got here
Editions are the latest chapter in a longer story: each earlier era baked its behavior into a syntax keyword, and migrating between them was all or nothing.
Further Reading
- Protobuf Editions are here: don't panic
What editions change, what they deliberately don't, and how to think about migrating.
Next
Standard Options
Protobuf options at the file, message, and field level: what the well-known options do and how options change generated code without changing the wire format.