Skip to content

Commit cef52e9

Browse files
authored
Merge pull request #120 from Logofile/sync
Documentation updates
2 parents b46fe77 + daab018 commit cef52e9

File tree

9 files changed

+107
-10
lines changed

9 files changed

+107
-10
lines changed

content/getting-started/javatutorial.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ Person john =
350350
.addPhones(
351351
Person.PhoneNumber.newBuilder()
352352
.setNumber("555-4321")
353-
.setType(Person.PhoneType.PHONE_TYPE_HOME))
353+
.setType(Person.PhoneType.PHONE_TYPE_HOME)
354+
.build());
354355
.build();
355356
```
356357

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/2024-01-31.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
+++
2+
title = "Changes announced January 31, 2024"
3+
linkTitle = "January 31, 2024"
4+
toc_hide = "true"
5+
description = "Changes announced for Protocol Buffers on January 31, 2024."
6+
type = "docs"
7+
+++
8+
9+
This topic covers breaking changes in Python in the 26.x line.
10+
11+
## Python Breaking Changes
12+
13+
### Removing `setup.py` and `setup.cfg` support from GitHub
14+
15+
In the 26.x release, `setup.py` and `setup.cfg` will no longer be present in the
16+
`python/` directory of
17+
[the GitHub repository](https://github.com/protocolbuffers/protobuf/tree/main/python)
18+
or GitHub
19+
[release tarballs](https://github.com/protocolbuffers/protobuf/releases). This
20+
means it will no longer be possible to build a Python package directly from the
21+
GitHub repo or release tarball.
22+
23+
The Python source packages published
24+
[on PyPI](https://pypi.org/project/protobuf/#files) *will* continue to have a
25+
`setup.py` in the top-level directory. This is the supported and recommended way
26+
of building Python binary packages, for users who do not want to use the binary
27+
packages that we distribute on PyPI.
28+
29+
For more information, see
30+
[#15671](https://github.com/protocolbuffers/protobuf/pull/15671).

content/news/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ 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.
14+
* [January 31, 2024](/news/2024-01-31) - Breaking
15+
changes in the 26.x line for Python
1216
* [January 5, 2024](/news/2024-01-05) - Breaking
1317
changes in the 26.x line for Ruby and Python
1418
* [December 27, 2023](/news/2023-12-27) - Breaking

content/programming-guides/field_presence.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,9 @@ Is field presence tracked?
613613

614614
Field type | Tracked?
615615
---------------------- | ------------------------
616+
*Other* singular field | if defined as `optional`
616617
Singular message field | yes
617618
Field in a oneof | yes
618-
*Other* singular field | if defined as `optional`
619619
Repeated field & map | no
620620

621621
**Edition 2023:**

content/programming-guides/proto2.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,14 +622,16 @@ different languages, see
622622

623623
Removing enum values is a breaking change for persisted protos. Instead of
624624
removing a value, mark the value with the `reserved` keyword to prevent the enum
625-
value from being code-generated:
625+
value from being code-generated, or keep the value but indicate that it will be
626+
removed later by using the `deprecated` field option:
626627

627628
```proto
628629
enum PhoneType {
629630
PHONE_TYPE_UNSPECIFIED = 0;
630631
PHONE_TYPE_MOBILE = 1;
631632
PHONE_TYPE_HOME = 2;
632633
PHONE_TYPE_WORK = 3 [deprecated=true];
634+
reserved 4,5;
633635
}
634636
```
635637

@@ -1824,13 +1826,26 @@ value.
18241826
18251827
A proto2 JSON implementation may provide the following options:
18261828
1829+
* **Always emit fields without presence**: Fields that don't support presence
1830+
and that have their default value are omitted by default in JSON output (for
1831+
example, an implicit presence integer with a 0 value, implicit presence
1832+
string fields that are empty strings, and empty repeated and map fields). An
1833+
implementation may provide an option to override this behavior and output
1834+
fields with their default values.
1835+
1836+
As of v25.x, the C++, Java, and Python implementations are nonconformant, as
1837+
this flag affects proto2 `optional` fields but not proto3 `optional` fields.
1838+
A fix is planned for a future release.
1839+
18271840
* **Ignore unknown fields**: Proto2 JSON parser should reject unknown fields
18281841
by default but may provide an option to ignore unknown fields in parsing.
1842+
18291843
* **Use proto field name instead of lowerCamelCase name**: By default proto2
18301844
JSON printer should convert the field name to lowerCamelCase and use that as
18311845
the JSON name. An implementation may provide an option to use proto field
18321846
name as the JSON name instead. Proto2 JSON parsers are required to accept
18331847
both the converted lowerCamelCase name and the proto field name.
1848+
18341849
* **Emit enum values as integers instead of strings**: The name of an enum
18351850
value is used by default in JSON output. An option may be provided to use
18361851
the numeric value of the enum value instead.

content/programming-guides/proto3.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,9 +1383,12 @@ value.
13831383

13841384
A proto3 JSON implementation may provide the following options:
13851385

1386-
* **Emit fields with default values**: Fields with default values are omitted
1387-
by default in proto3 JSON output. An implementation may provide an option to
1388-
override this behavior and output fields with their default values.
1386+
* **Always emit fields without presence**: Fields that don't support presence
1387+
and that have their default value are omitted by default in JSON output (for
1388+
example, an implicit presence integer with a 0 value, implicit presence
1389+
string fields that are empty strings, and empty repeated and map fields). An
1390+
implementation may provide an option to override this behavior and output
1391+
fields with their default values.
13891392
* **Ignore unknown fields**: Proto3 JSON parser should reject unknown fields
13901393
by default but may provide an option to ignore unknown fields in parsing.
13911394
* **Use proto field name instead of lowerCamelCase name**: By default proto3

content/reference/python/python-generated.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,11 @@ foo.bars.add(i=3)
534534
foo.bars[0] = Bar(i=15) # Raises an exception
535535
# WRONG!
536536
foo.bars[:] = [Bar(i=15), Bar(i=17)] # Also raises an exception
537-
# RIGHT
537+
# WRONG!
538+
# AttributeError: Cannot delete field attribute
538539
del foo.bars
540+
# RIGHT
541+
del foo.bars[:]
539542
foo.bars.extend([Bar(i=15), Bar(i=17)])
540543
```
541544

content/support/version-support.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ type = "docs"
1010

1111
Support windows for protoc and the various languages are covered in the tables
1212
later in this topic. Version numbers throughout this topic use
13-
[SemVer](https://semver.org) conventions; in the version "3.21.7," we
14-
say that "3" is the major version, "21" is the minor version, and "7" is the
15-
micro or patch number.
13+
[SemVer](https://semver.org) conventions; in the version "3.21.7," we say that
14+
"3" is the major version, "21" is the minor version, and "7" is the micro or
15+
patch number.
1616

1717
Starting with the v20.x protoc release, we changed our versioning scheme to
1818
enable nimbler updates to language-specific parts of Protocol Buffers. In the
@@ -34,6 +34,11 @@ release updates quarterly, on a best-effort basis. Our support windows are
3434
defined by our
3535
[library breaking change policy](https://opensource.google/documentation/policies/library-breaking-change).
3636

37+
Protobuf does *not* consider enforcement of its documented language, tooling,
38+
platform, and library support policies to be a breaking change. For example, a
39+
release may drop support for an EOL language version without bumping major
40+
versions.
41+
3742
## Support Duration {#duration}
3843

3944
The most recent release is always supported. Support for earlier minor versions
@@ -373,6 +378,8 @@ This table graphically shows support durations.
373378
Protobuf is committed to following the platform and library support policy
374379
described in
375380
[.NET Support Policy](https://opensource.google/documentation/policies/dotnet-support).
381+
For specific versions supported, see
382+
[Foundational .NET Support Matrix](https://github.com/google/oss-policies-info/blob/main/foundational-dotnet-support-matrix.md).
376383

377384
## Java {#java}
378385

@@ -570,6 +577,14 @@ Java will target making major version bumps annually in Q1 of each year.
570577
</tr>
571578
</table>
572579

580+
### Java Platform and Library Support {#java-support}
581+
582+
Protobuf is committed to following the platform and library support policy
583+
described in
584+
[Java Support Policy](https://cloud.google.com/java/docs/supported-java-versions).
585+
For specific versions supported, see
586+
[Foundational Java Support Matrix](https://github.com/google/oss-policies-info/blob/main/foundational-java-support-matrix.md).
587+
573588
## Objective-C {#objc}
574589

575590
This table provides specific dates for support duration.

0 commit comments

Comments
 (0)