Add clarifying comments about fields disallowed in Editions
PiperOrigin-RevId: 572264242
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index 1ad953f..a466e12 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -1721,8 +1721,8 @@
"BYTES\020\014\022\017\n\013TYPE_UINT32\020\r\022\r\n\tTYPE_ENUM\020\016\022"
"\021\n\rTYPE_SFIXED32\020\017\022\021\n\rTYPE_SFIXED64\020\020\022\017\n"
"\013TYPE_SINT32\020\021\022\017\n\013TYPE_SINT64\020\022\"C\n\005Label"
- "\022\022\n\016LABEL_OPTIONAL\020\001\022\022\n\016LABEL_REQUIRED\020\002"
- "\022\022\n\016LABEL_REPEATED\020\003\"T\n\024OneofDescriptorP"
+ "\022\022\n\016LABEL_OPTIONAL\020\001\022\022\n\016LABEL_REPEATED\020\003"
+ "\022\022\n\016LABEL_REQUIRED\020\002\"T\n\024OneofDescriptorP"
"roto\022\014\n\004name\030\001 \001(\t\022.\n\007options\030\002 \001(\0132\035.go"
"ogle.protobuf.OneofOptions\"\244\002\n\023EnumDescr"
"iptorProto\022\014\n\004name\030\001 \001(\t\0228\n\005value\030\002 \003(\0132"
@@ -2048,8 +2048,8 @@
(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_OPTIONAL;
-constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REQUIRED;
constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REPEATED;
+constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REQUIRED;
constexpr FieldDescriptorProto_Label FieldDescriptorProto::Label_MIN;
constexpr FieldDescriptorProto_Label FieldDescriptorProto::Label_MAX;
constexpr int FieldDescriptorProto::Label_ARRAYSIZE;
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index e9325b1..afce859 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -240,8 +240,8 @@
}
enum FieldDescriptorProto_Label : int {
FieldDescriptorProto_Label_LABEL_OPTIONAL = 1,
- FieldDescriptorProto_Label_LABEL_REQUIRED = 2,
FieldDescriptorProto_Label_LABEL_REPEATED = 3,
+ FieldDescriptorProto_Label_LABEL_REQUIRED = 2,
};
PROTOBUF_EXPORT bool FieldDescriptorProto_Label_IsValid(int value);
@@ -8747,8 +8747,8 @@
using Label = FieldDescriptorProto_Label;
static constexpr Label LABEL_OPTIONAL = FieldDescriptorProto_Label_LABEL_OPTIONAL;
- static constexpr Label LABEL_REQUIRED = FieldDescriptorProto_Label_LABEL_REQUIRED;
static constexpr Label LABEL_REPEATED = FieldDescriptorProto_Label_LABEL_REPEATED;
+ static constexpr Label LABEL_REQUIRED = FieldDescriptorProto_Label_LABEL_REQUIRED;
static inline bool Label_IsValid(int value) {
return FieldDescriptorProto_Label_IsValid(value);
}
diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto
index 8976ed6..90dd7bf 100644
--- a/src/google/protobuf/descriptor.proto
+++ b/src/google/protobuf/descriptor.proto
@@ -227,9 +227,10 @@
TYPE_BOOL = 8;
TYPE_STRING = 9;
// Tag-delimited aggregate.
- // Group type is deprecated and not supported in proto3. However, Proto3
+ // Group type is deprecated and not supported after google.protobuf. However, Proto3
// implementations should still be able to parse the group wire format and
- // treat group fields as unknown fields.
+ // treat group fields as unknown fields. In Editions, the group wire format
+ // can be enabled via the `message_encoding` feature.
TYPE_GROUP = 10;
TYPE_MESSAGE = 11; // Length-delimited aggregate.
@@ -246,8 +247,11 @@
enum Label {
// 0 is reserved for errors
LABEL_OPTIONAL = 1;
- LABEL_REQUIRED = 2;
LABEL_REPEATED = 3;
+ // The required label is only allowed in google.protobuf. In proto3 and Editions
+ // it's explicitly prohibited. In Editions, the `field_presence` feature
+ // can be used to get this behavior.
+ LABEL_REQUIRED = 2;
}
optional string name = 1;
@@ -640,7 +644,9 @@
// a more efficient representation on the wire. Rather than repeatedly
// writing the tag and type for each element, the entire array is encoded as
// a single length-delimited blob. In proto3, only explicit setting it to
- // false will avoid using packed encoding.
+ // false will avoid using packed encoding. This option is prohibited in
+ // Editions, but the `repeated_field_encoding` feature can be used to control
+ // the behavior.
optional bool packed = 2;
// The jstype option determines the JavaScript type used for values of the