Whether a field holding its zero value reaches the wire at all is a per-field choice, set by its field presence mode.
On the wire, an implicit presence field holding its zero value writes no bytes, not even a tag. An explicit presence field writes its tag and the value, 08 00 for an int32 in field 1 set to zero, as soon as your code sets it. Message fields and members of a oneof always have explicit presence, regardless of the file's default.
Edition 2024 defaults to EXPLICIT. Set features.field_presence = IMPLICIT; on a file or a field to leave default-valued fields off the wire instead.
Omitted from the wire whenever it holds the zero value, so a reader cannot tell this from never set.
Edition 2024's default. Once set, the field is written even when the value is zero.
Further Reading
- Application note: Field presence
The official deep dive on presence semantics across proto2, proto3, and editions, and how each runtime exposes them.
Next
Parse Loop
The Protobuf parse loop, field by field: read a tag, dispatch on the wire type, consume the value, and repeat until the bytes run out.