Skip to content

Commit daab018

Browse files
Protocol Buffer TeamLogofile
authored andcommitted
Add a news article about changes to JSON default values representation in Java, C++, and Python.
PiperOrigin-RevId: 604390039 Change-Id: I72a6d70c7f93ef2a5bed1664496bb037a1621c4c
1 parent 6cce079 commit daab018

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

content/news/2022-02-05.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
+++
2+
title = "Changes announced February 5, 2024"
3+
linkTitle = "February 5, 2024"
4+
toc_hide = "true"
5+
description = "Changes announced for Protocol Buffers on February 5, 2024."
6+
type = "docs"
7+
+++
8+
9+
This topic covers breaking changes in Java, C++, and Python in the 26.x line.
10+
11+
## JSON Formatter Option Changes {#JSON}
12+
13+
Starting in the 26.x line, the JSON formatter option to print default-valued
14+
fields is replaced with a fixed way to handle proto2 and proto3 `optional`
15+
fields consistently.
16+
17+
* Java: `includingDefaultValueFields()` is replaced with
18+
`alwaysPrintFieldsWithNoPresence()`.
19+
* C++: `always_print_default_values` is replaced with
20+
`always_print_fields_with_no_presence=True`.
21+
* Py: `including_default_value_fields=True` is replaced with
22+
`always_print_fields_with_no_presence=True`.
23+
24+
The new flag behaves identically to the old flag on proto3 messages, but no
25+
longer applies to proto2 `optional` fields. The old flags applied to proto2
26+
`optional` fields but not proto3 `optional` fields.

content/news/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ no_list = "true"
99
News topics provide information about past events and changes with Protocol
1010
Buffers, and plans for upcoming changes.
1111

12+
* [February 5, 2024](/news/2024-02-05) - Breaking
13+
changes in Java, C++, and Python in the 26.x line.
1214
* [January 31, 2024](/news/2024-01-31) - Breaking
1315
changes in the 26.x line for Python
1416
* [January 5, 2024](/news/2024-01-05) - Breaking

0 commit comments

Comments
 (0)