@@ -101,6 +101,8 @@ message DescriptorProto {
101
101
message ExtensionRange {
102
102
optional int32 start = 1 ;
103
103
optional int32 end = 2 ;
104
+
105
+ optional ExtensionRangeOptions options = 3 ;
104
106
}
105
107
repeated ExtensionRange extension_range = 5 ;
106
108
@@ -121,6 +123,63 @@ message DescriptorProto {
121
123
repeated string reserved_name = 10 ;
122
124
}
123
125
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
+
124
183
// Describes a field within a message.
125
184
message FieldDescriptorProto {
126
185
enum Type {
@@ -813,4 +872,4 @@ message GeneratedCodeInfo {
813
872
// the last relevant byte (so the length of the text = end - begin).
814
873
optional int32 end = 4 ;
815
874
}
816
- }
875
+ }
0 commit comments