Changes announced April 11, 2023
Syntax Reflection Deprecation
v23 will deprecate the ability to check syntax version using reflection. The deprecation will be included as warnings at build time. The capability will be removed in a future release.
Adding support for ctype=CORD in C++
v23 will add ctype=CORD
support for singular bytes
fields, including oneof
fields, to specify that data should be stored using
absl::cord
instead of string
. Support may be added in future releases for singular
string
field types and for repeated
string
and byte
fields if there is
enough interest from the open source community.
ctype=CORD
will have no effect on extensions.
You will be able to add the support using field options:
optional bytes foo = 25 [ctype=CORD];
Option Retention
Options now have a notion of retention, which controls whether an option is
retained in the generated code. Options have always had runtime retention by
default, meaning that they are retained in the generated code and are thus
visible at runtime in the generated descriptor pool. However, you can now set
retention = RETENTION_SOURCE
to specify that an option (or field within an
option) must not be retained at runtime. This is called source retention.
Setting retention looks like this:
extend google.protobuf.FileOptions {
optional int32 source_retention_option = 1234
[retention = RETENTION_SOURCE];
}
It can also be set on a plain field, in which case it takes effect only when that field appears inside an option:
message OptionsMessage {
optional int32 source_retention_field = 1 [retention = RETENTION_SOURCE];
}
For more information, see Option Retention.
Dropping Support for Bazel <5.3
v23 will drop support for Bazel 4. Protobuf will continue to support the Bazel 5 LTS with Bazel 5.3 as the minimum required version. This is per the build support policy described in Foundational C++ Support Policy and as reflected in the versions in Foundational C++ Support.