@@ -101,6 +101,8 @@ message DescriptorProto {
101101 message ExtensionRange {
102102 optional int32 start = 1 ;
103103 optional int32 end = 2 ;
104+
105+ optional ExtensionRangeOptions options = 3 ;
104106 }
105107 repeated ExtensionRange extension_range = 5 ;
106108
@@ -121,6 +123,63 @@ message DescriptorProto {
121123 repeated string reserved_name = 10 ;
122124}
123125
126+
127+ message ExtensionRangeOptions {
128+ // The parser stores options it doesn't recognize here. See above.
129+ repeated UninterpretedOption uninterpreted_option = 999 ;
130+
131+ message Declaration {
132+ // The extension number declared within the extension range.
133+ optional int32 number = 1 ;
134+
135+ // The fully-qualified name of the extension field. There must be a leading
136+ // dot in front of the full name.
137+ optional string full_name = 2 ;
138+
139+ // The fully-qualified type name of the extension field. Unlike
140+ // Metadata.type, Declaration.type must have a leading dot for messages
141+ // and enums.
142+ optional string type = 3 ;
143+
144+ // If true, indicates that the number is reserved in the extension range,
145+ // and any extension field with the number will fail to compile. Set this
146+ // when a declared extension field is deleted.
147+ optional bool reserved = 5 ;
148+
149+ // If true, indicates that the extension must be defined as repeated.
150+ // Otherwise the extension must be defined as optional.
151+ optional bool repeated = 6 ;
152+
153+ reserved 4 ; // removed is_repeated
154+ }
155+
156+ // For external users: DO NOT USE. We are in the process of open sourcing
157+ // extension declaration and executing internal cleanups before it can be
158+ // used externally.
159+ repeated Declaration declaration = 2 [retention = RETENTION_SOURCE ];
160+
161+ // The verification state of the extension range.
162+ enum VerificationState {
163+ // All the extensions of the range must be declared.
164+ DECLARATION = 0 ;
165+ UNVERIFIED = 1 ;
166+ }
167+
168+ // The verification state of the range.
169+ // TODO(b/278783756): flip the default to DECLARATION once all empty ranges
170+ // are marked as UNVERIFIED.
171+ optional VerificationState verification = 3
172+ [default = UNVERIFIED , retention = RETENTION_SOURCE ];
173+
174+ // Clients can define custom options in extensions of this message. See above.
175+ // BEGIN GOOGLE-INTERNAL
176+ // Extension numbers > 530,000,000 must be forward-declared in
177+ // google3/third_party/protobuf/extdecl_extension_range_options.h. See
178+ // go/extension-declaration-reserved-numbers for more information.
179+ // END GOOGLE-INTERNAL
180+ extensions 1000 to max;
181+ }
182+
124183// Describes a field within a message.
125184message FieldDescriptorProto {
126185 enum Type {
@@ -813,4 +872,4 @@ message GeneratedCodeInfo {
813872 // the last relevant byte (so the length of the text = end - begin).
814873 optional int32 end = 4 ;
815874 }
816- }
875+ }
0 commit comments