Changes announced February 5, 2024
Changes announced for Protocol Buffers on February 5, 2024.
This topic covers breaking changes in Java, C++, and Python in the 26.x line.
JSON Formatter Option Changes
Starting in the 26.x line, the JSON formatter option to print default-valued
fields is replaced with a fixed way to handle proto2 and proto3 optional
fields consistently.
- Java:
includingDefaultValueFields()
is replaced withalwaysPrintFieldsWithNoPresence()
. - C++:
always_print_default_values
is replaced withalways_print_fields_with_no_presence=True
. - Py:
including_default_value_fields=True
is replaced withalways_print_fields_with_no_presence=True
.
The new flag behaves identically to the old flag on proto3 messages, but no
longer applies to proto2 optional
fields. The old flags applied to proto2
optional
fields but not proto3 optional
fields.