Skip to content

Commit 2ffd719

Browse files
authored
Merge pull request #105 from Logofile/sync
Periodic documentation update
2 parents 77975f0 + 1b3947e commit 2ffd719

21 files changed

+99
-45
lines changed

content/editions/features.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ and after of a proto3 file.
4949
The following code sample shows a proto2 file:
5050

5151
```proto
52-
syntax = "proto2"
52+
syntax = "proto2";
5353
5454
enum Foo {
5555
A = 2;
@@ -62,7 +62,7 @@ After running [Prototiller](#prototiller), the equivalent code might look like
6262
this:
6363

6464
```proto
65-
edition = "2023"
65+
edition = "2023";
6666
6767
enum Foo {
6868
option features.enum_type = CLOSED;
@@ -104,7 +104,7 @@ for more information.
104104
The following code sample shows a proto2 file:
105105

106106
```proto
107-
syntax = "proto2"
107+
syntax = "proto2";
108108
109109
message Foo {
110110
required int32 x = 1;
@@ -116,7 +116,7 @@ message Foo {
116116
After running Prototiller, the equivalent code might look like this:
117117

118118
```proto
119-
edition = "2023"
119+
edition = "2023";
120120
121121
message Foo {
122122
int32 x = 1 [features.field_presence = LEGACY_REQUIRED];
@@ -140,7 +140,7 @@ message Bar {
140140
After running Prototiller, the equivalent code might look like this:
141141

142142
```proto
143-
edition = "2023"
143+
edition = "2023";
144144
option features.field_presence = IMPLICIT;
145145
146146
message Bar {
@@ -227,7 +227,7 @@ and after of a proto3 file.
227227
The following code sample shows a proto2 file:
228228

229229
```proto
230-
syntax = "proto2"
230+
syntax = "proto2";
231231
232232
message Foo {
233233
group Bar = 1 {
@@ -240,7 +240,7 @@ message Foo {
240240
After running Prototiller, the equivalent code might look like this:
241241

242242
```proto
243-
edition = "2023"
243+
edition = "2023";
244244
245245
message Foo {
246246
message Bar {
@@ -275,7 +275,7 @@ for `repeated` fields has been migrated to in Editions.
275275
The following code sample shows a proto2 file:
276276

277277
```proto
278-
syntax = "proto2"
278+
syntax = "proto2";
279279
280280
message Foo {
281281
repeated int32 bar = 6 [packed=true];
@@ -286,8 +286,8 @@ message Foo {
286286
After running Prototiller, the equivalent code might look like this:
287287

288288
```proto
289-
edition = "2023"
290-
options features.repeated_field_encoding = EXPANDED;
289+
edition = "2023";
290+
option features.repeated_field_encoding = EXPANDED;
291291
292292
message Foo {
293293
repeated int32 bar = 6 [features.repeated_field_encoding=PACKED];
@@ -309,7 +309,7 @@ message Foo {
309309
After running Prototiller, the equivalent code might look like this:
310310

311311
```proto
312-
edition = "2023"
312+
edition = "2023";
313313
314314
message Foo {
315315
repeated int32 bar = 6;
@@ -346,7 +346,7 @@ and after of a proto3 file.
346346
The following code sample shows a proto2 file:
347347

348348
```proto
349-
syntax = "proto2"
349+
syntax = "proto2";
350350
351351
message MyMessage {
352352
string foo = 1;
@@ -356,7 +356,7 @@ message MyMessage {
356356
After running Prototiller, the equivalent code might look like this:
357357

358358
```proto
359-
edition = "2023"
359+
edition = "2023";
360360
361361
message MyMessage {
362362
string foo = 1 [features.utf8_validation = NONE];
@@ -410,7 +410,7 @@ message Msg {
410410
After running Prototiller, the equivalent code might look like this:
411411

412412
```proto
413-
edition = "2023"
413+
edition = "2023";
414414
415415
import "myproject/proto3file.proto";
416416

content/editions/overview.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ message, field, enum, and so on, that specify the behavior of protoc, the code
1919
generators, and protobuf runtimes. You can explicitly override a behavior at
2020
those different levels (file, message, field, ...) when your needs don't match
2121
the default behavior for the edition you've selected. You can also override your
22-
overrides. The [section later in this topic on inheritance](#inheritance) goes
22+
overrides. The [section later in this topic on lexical scoping](#scoping) goes
2323
into more detail on that.
2424

2525
## Lifecycle of a Feature {#lifecycles}
@@ -202,16 +202,19 @@ message Player {
202202

203203
</section>
204204

205-
### Inheritance {#inheritance}
205+
<a name="inheritance"></a>
206206

207-
Editions syntax supports inheritance, with a per-feature list of allowed
207+
### Lexical Scoping {#scoping}
208+
209+
Editions syntax supports lexical scoping, with a per-feature list of allowed
208210
targets. For example, in the first edition, features can be specified at only
209-
the file level or the lowest level of granularity. Inheritance enables you to
210-
set the default behavior for a feature across an entire file, and then override
211-
that behavior at the message, field, enum, enum value, oneof, service, or
212-
method. Settings made at a higher level (file, message) apply when no setting is
213-
made within the same scope (field, enum value). Any features not explicitly set
214-
conform to the behavior defined in the edition version used for the .proto file.
211+
the file level or the lowest level of granularity. The implementation of lexical
212+
scoping enables you to set the default behavior for a feature across an entire
213+
file, and then override that behavior at the message, field, enum, enum value,
214+
oneof, service, or method level. Settings made at a higher level (file, message)
215+
apply when no setting is made within the same scope (field, enum value). Any
216+
features not explicitly set conform to the behavior defined in the edition
217+
version used for the .proto file.
215218

216219
The following code sample shows some features being set at the file, message,
217220
and enum level. The settings are in the highlighted lines:
@@ -243,7 +246,7 @@ message Person {
243246

244247
In the preceding example, the presence feature is set to `IMPLICIT`; it would
245248
default to `EXPLICIT` if it wasn't set. The `Pay_Type` `enum` will be `CLOSED`,
246-
as it inherits the file-level setting. The `Employment` `enum`, though, will be
249+
as it applies the file-level setting. The `Employment` `enum`, though, will be
247250
`OPEN`, as it is set within the enum.
248251

249252
### Prototiller {#prototiller}

content/getting-started/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
+++
24
title = "Tutorials"
35
weight = 200

content/news/2023-08-15.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
+++
24
title = "Changes Announced on August 15, 2023"
35
linkTitle = "August 15, 2023"

content/programming-guides/extension_declarations.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,15 @@ Deleting an extension declaration opens the door to accidental reuse in the
221221
future. If the extension is no longer processed and the definition is deleted,
222222
the extension declaration can be [marked reserved](#reserved).
223223

224-
### Never Use a Field Number from the `reserved` List for a New Extension Declaration {#never-reuse-reserved}
224+
### Never Use a Field Name or Number from the `reserved` List for a New Extension Declaration {#never-reuse-reserved}
225225

226226
Reserved numbers may have been used for fields or other extensions in the past.
227227

228+
Using the `full_name` of a reserved field
229+
is not recommended
230+
due
231+
to the possibility of ambiguity when using textproto.
232+
228233
### Never change the type of an existing extension declaration {#never-change-type}
229234

230235
Changing the extension field's type can result in data corruption.

content/programming-guides/proto3.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,9 @@ from an input stream.
244244
message type, as well as a special `Builder` class for creating message
245245
class instances.
246246
* For **Kotlin**, in addition to the Java generated code, the compiler
247-
generates a `.kt` file for each message type, containing a DSL which can be
248-
used to simplify creating message instances.
247+
generates a `.kt` file for each message type with an improved Kotlin API.
248+
This includes a DSL that simplifies creating message instances, a nullable
249+
field accessor, and a copy function.
249250
* **Python** is a little different — the Python compiler generates a module
250251
with a static descriptor of each message type in your `.proto`, which is
251252
then used with a *metaclass* to create the necessary Python data access
@@ -518,7 +519,8 @@ type-specific:
518519
* For strings, the default value is the empty string.
519520
* For bytes, the default value is empty bytes.
520521
* For bools, the default value is false.
521-
* For numeric types, the default value is zero.
522+
* For numeric types, the default value is zero. For float and double types,
523+
-0.0 and 0.0 are treated as equivalent, and will round-trip.
522524
* For enums, the default value is the **first defined enum value**, which must
523525
be 0.
524526
* For message fields, the field is not set. Its exact value is
@@ -534,7 +536,8 @@ whether a boolean was set to `false`) or just not set at all: you should bear
534536
this in mind when defining your message types. For example, don't have a boolean
535537
that switches on some behavior when set to `false` if you don't want that
536538
behavior to also happen by default. Also note that if a scalar message field
537-
**is** set to its default, the value will not be serialized on the wire.
539+
**is** set to its default, the value will not be serialized on the wire. If a
540+
float or double value is set to -0 or +0, it will not be serialized.
538541

539542
See the [generated code guide](/reference/) for your
540543
chosen language for more details about how defaults work in generated code.
@@ -875,10 +878,8 @@ fields that the parser does not recognize. For example, when an old binary
875878
parses data sent by a new binary with new fields, those new fields become
876879
unknown fields in the old binary.
877880

878-
Originally, proto3 messages always discarded unknown fields during parsing, but
879-
in version 3.5 we reintroduced the preservation of unknown fields to match the
880-
proto2 behavior. In versions 3.5 and later, unknown fields are retained during
881-
parsing and included in the serialized output.
881+
Proto3 messages preserve unknown fields and includes them during parsing and in
882+
the serialized output, which matches proto2 behavior.
882883

883884
## Any {#any}
884885

content/reference/cpp/api-docs/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
+++
24
title = "C++ Reference"
35
toc_hide = "true"

content/reference/cpp/api-docs/google.protobuf.arena.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
+++
24
title = "arena.h"
35
toc_hide = "true"

content/reference/cpp/api-docs/google.protobuf.compiler.ruby_generator.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
+++
24
title = "ruby_generator.h"
35
toc_hide = "true"

content/reference/cpp/api-docs/google.protobuf.dynamic_message.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
+++
24
title = "dynamic_message.h"
35
toc_hide = "true"

0 commit comments

Comments
 (0)