@@ -24,6 +24,36 @@ act like proto2 or proto3 files. For more information on how Editions and
2424Features work together to set behavior, see
2525[ Protobuf Editions Overview] ( /editions/overview ) .
2626
27+ Each of the following sections has an entry for what scope the feature applies
28+ to. This can include file, enum, message, or field. The following sample shows a
29+ mock feature applied to each scope:
30+
31+ ``` proto
32+ edition = "2023";
33+
34+ // File-scope definition
35+ option features.bar = BAZ;
36+
37+ enum Foo {
38+ // Enum-scope definition
39+ option features.bar = QUX;
40+
41+ A = 1;
42+ B = 2;
43+ }
44+
45+ message Corge {
46+ // Message-scope definition
47+ option features.bar = QUUX;
48+
49+ // Field-scope definition
50+ Foo A = 1 [features.bar = GRAULT];
51+ }
52+ ```
53+
54+ In this example, the setting ` GRAULT ` in the field-scope feature definition
55+ overrides the message-scope QUUX setting.
56+
2757### ` features.enum_type ` {#enum_type}
2858
2959This feature sets the behavior for how enum values that aren't contained within
@@ -38,7 +68,7 @@ and after of a proto3 file.
3868 unknown field set.
3969* ` OPEN: ` Open enums parse out of range values into their fields directly.
4070
41- ** Applicable to the following elements :** File, Enum
71+ ** Applicable to the following scopes :** File, Enum
4272
4373** Default behavior in Edition 2023:** ` OPEN `
4474
@@ -90,7 +120,7 @@ whether a protobuf field has a value.
90120 serialized onto the wire (even if it is explicitly set). ` has_* ` functions
91121 are not generated for fields set to ` IMPLICIT ` .
92122
93- ** Applicable to the following elements :** File, Field
123+ ** Applicable to the following scopes :** File, Field
94124
95125** Default value in the Edition 2023:** ` EXPLICIT `
96126
@@ -169,7 +199,7 @@ and after of a proto3 file. Editions behavior matches the behavior in proto3.
169199 JSON. Certain protos are allowed that can result in unspecified behavior at
170200 runtime (such as many:1 or 1: many mappings).
171201
172- ** Applicable to the following elements :** File, Message, Enum
202+ ** Applicable to the following scopes :** File, Message, Enum
173203
174204** Default behavior in Edition 2023:** ` ALLOW `
175205
@@ -215,7 +245,7 @@ and after of a proto3 file.
215245* ` DELIMITED ` : Message-typed fields are encoded as
216246 [ groups] ( /programming-guides/proto2#groups ) .
217247
218- ** Applicable to the following elements :** File, Field
248+ ** Applicable to the following scopes :** File, Field
219249
220250** Default behavior in Edition 2023:** ` LENGTH_PREFIXED `
221251
@@ -264,7 +294,7 @@ for `repeated` fields has been migrated to in Editions.
264294* ` EXPANDED ` : ` Repeated ` fields are each encoded with the field number for
265295 each value.
266296
267- ** Applicable to the following elements :** File, Field
297+ ** Applicable to the following scopes :** File, Field
268298
269299** Default behavior in Edition 2023:** ` PACKED `
270300
@@ -335,7 +365,7 @@ and after of a proto3 file.
335365 Parsers may handle this type of field in an unpredictable way, such as
336366 replacing invalid characters. This is the default proto2 behavior.
337367
338- ** Applicable to the following elements :** File, Field
368+ ** Applicable to the following scopes :** File, Field
339369
340370** Default behavior in Edition 2023:** ` VERIFY `
341371
@@ -387,7 +417,7 @@ before and after of a proto3 file.
387417* ` true ` : Treats the enum as closed regardless of [ ` enum_type ` ] ( #enum_type ) .
388418* ` false ` : Respect whatever is set in the ` enum_type ` .
389419
390- ** Applicable to the following elements :** File, Field
420+ ** Applicable to the following scopes :** File, Field
391421
392422** Default behavior in Edition 2023:** ` false `
393423
@@ -442,7 +472,7 @@ before and after of a proto3 file.
442472* ` VERIFY ` : Overrides the file-level ` features.utf8_validation ` setting to
443473 force it to ` VERIFY ` for Java only.
444474
445- ** Applicable to the following elements :** Field, File
475+ ** Applicable to the following scopes :** Field, File
446476
447477** Default behavior in Edition 2023:** ` DEFAULT `
448478
0 commit comments