reproto 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. .git/COMMIT_EDITMSG +30 -1
  2. .git/index +0 -0
  3. .git/logs/HEAD +1 -0
  4. .git/logs/refs/heads/iyue +1 -0
  5. .git/logs/refs/remotes/gitlab/iyue +1 -0
  6. .git/logs/refs/remotes/origin/iyue +1 -0
  7. .git/objects/03/3fab23ccc74b707a31f6f37dc5df42c100aac0 +0 -0
  8. .git/objects/07/b71df33935c14ddf99e3480c04eca4685028bc +0 -0
  9. .git/objects/0b/e20ea749c6ae1075ae98f9426e00b0a4a235af +0 -0
  10. .git/objects/13/5f50fea51c72f977f48d06a7584aba0f61e260 +0 -0
  11. .git/objects/1b/97584ebada3e93d7a2cfa4a1aae0b79c414d20 +0 -0
  12. .git/objects/1b/f0c1ad9586578e8332d061f7648dcb041ec063 +0 -0
  13. .git/objects/1e/46816d16e7c9db7575f1964403c3daa105be5c +0 -0
  14. .git/objects/27/24208ca2442e8ab9b453d0eb230fa41243b270 +0 -0
  15. .git/objects/2d/2b812ca27c477f9e1b2c2706a5eb795ffcf8eb +0 -0
  16. .git/objects/3f/b8830f516342a0ae1cb7c34b65016827cb9570 +4 -0
  17. .git/objects/41/f40c22247de377be99e30784229f3f128508a2 +0 -0
  18. .git/objects/48/cb11e75518a53be14146018214110986fade67 +0 -0
  19. .git/objects/4f/c6dc41f9c0a1a8e0eedd3ba49c43d78d0dbaba +0 -0
  20. .git/objects/59/4c23f158ccbd0a4288f9ea046d06160195afbf +0 -0
  21. .git/objects/5b/d4d87753b79e9157817f0c2e6964a731052854 +0 -0
  22. .git/objects/65/0189fe083bd711e45d463b229a72be619abad2 +0 -0
  23. .git/objects/66/663db35bfec8ef5f1a5b1c840fde1bb62a0eb8 +0 -0
  24. .git/objects/8a/0ed0ed8886fbc823e8d2258fa6d18699e94e25 +0 -0
  25. .git/objects/8d/d857b3d0ab3f5cd2e9173d532ef86e30df8eda +0 -0
  26. .git/objects/9e/23448ac58f907d9d123c32bdccedbb3d6741b5 +0 -0
  27. .git/objects/a0/d192999af7e2cbfa6a9ccd04d720a04e5a06d5 +0 -0
  28. .git/objects/a9/cc7923c34a4c97c5711d6309672f41d46c612a +0 -0
  29. .git/objects/af/c9cc15629847447063e86a82b8b56abb4fc08f +0 -0
  30. .git/objects/b1/db1c131cf32916028342c0037ce8eb57a8eb26 +0 -0
  31. .git/objects/b2/8334b94392b8af397a05ed702690fa6c9ab1ca +0 -0
  32. .git/objects/b8/7c89dcfce9e244ff5ef6a4bd394de12e8c8092 +0 -0
  33. .git/objects/d9/3bd435c8c7ad4efb83dff04d5450fabb9e3faf +0 -0
  34. .git/objects/e3/27755808d88c7ae5c06c229cf18bd0519646df +0 -0
  35. .git/objects/e5/83e7c40be934d16a1fa2e973487b395d930f42 +0 -0
  36. .git/objects/ed/1ae867d5e63195845afc58d88c38ecbdea97df +0 -0
  37. .git/objects/ef/f44e5099da27f7fb1ef14bb34902ccf4250b89 +0 -0
  38. .git/objects/f5/1be495b96272fa2e47f30071aed35ac1f0dd2c +0 -0
  39. .git/objects/fd/0bc07dc3c95e6168ab6d367d9eca139ac1e539 +0 -0
  40. .git/refs/heads/iyue +1 -1
  41. .git/refs/remotes/gitlab/iyue +1 -1
  42. .git/refs/remotes/origin/iyue +1 -1
  43. .gitignore +2 -1
  44. core/info_decoder.py +507 -6
  45. core/reconstructor.py +135 -6
  46. generation/proto_generator.py +51 -11
  47. include/google/protobuf/any.proto +162 -0
  48. include/google/protobuf/api.proto +207 -0
  49. include/google/protobuf/compiler/plugin.proto +180 -0
  50. include/google/protobuf/cpp_features.proto +67 -0
  51. include/google/protobuf/descriptor.proto +1417 -0
  52. include/google/protobuf/duration.proto +115 -0
  53. include/google/protobuf/empty.proto +51 -0
  54. include/google/protobuf/field_mask.proto +245 -0
  55. include/google/protobuf/go_features.proto +80 -0
  56. include/google/protobuf/java_features.proto +130 -0
  57. include/google/protobuf/source_context.proto +48 -0
  58. include/google/protobuf/struct.proto +95 -0
  59. include/google/protobuf/timestamp.proto +144 -0
  60. include/google/protobuf/type.proto +193 -0
  61. include/google/protobuf/wrappers.proto +157 -0
  62. parsing/java_parser.py +295 -12
  63. pyproject.toml +1 -1
  64. {reproto-0.1.1.dist-info → reproto-0.1.2.dist-info}/METADATA +1 -1
  65. {reproto-0.1.1.dist-info → reproto-0.1.2.dist-info}/RECORD +69 -20
  66. utils/builtin_proto.py +262 -0
  67. utils/type_utils.py +39 -6
  68. {reproto-0.1.1.dist-info → reproto-0.1.2.dist-info}/WHEEL +0 -0
  69. {reproto-0.1.1.dist-info → reproto-0.1.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,1417 @@
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // The messages in this file describe the definitions found in .proto files.
36
+ // A valid .proto file can be translated directly to a FileDescriptorProto
37
+ // without any other information (e.g. without reading its imports).
38
+
39
+ syntax = "proto2";
40
+
41
+ package google.protobuf;
42
+
43
+ option go_package = "google.golang.org/protobuf/types/descriptorpb";
44
+ option java_package = "com.google.protobuf";
45
+ option java_outer_classname = "DescriptorProtos";
46
+ option csharp_namespace = "Google.Protobuf.Reflection";
47
+ option objc_class_prefix = "GPB";
48
+ option cc_enable_arenas = true;
49
+
50
+ // descriptor.proto must be optimized for speed because reflection-based
51
+ // algorithms don't work during bootstrapping.
52
+ option optimize_for = SPEED;
53
+
54
+ // The protocol compiler can output a FileDescriptorSet containing the .proto
55
+ // files it parses.
56
+ message FileDescriptorSet {
57
+ repeated FileDescriptorProto file = 1;
58
+
59
+ // Extensions for tooling.
60
+ extensions 536000000 [declaration = {
61
+ number: 536000000
62
+ type: ".buf.descriptor.v1.FileDescriptorSetExtension"
63
+ full_name: ".buf.descriptor.v1.buf_file_descriptor_set_extension"
64
+ }];
65
+ }
66
+
67
+ // The full set of known editions.
68
+ enum Edition {
69
+ // A placeholder for an unknown edition value.
70
+ EDITION_UNKNOWN = 0;
71
+
72
+ // A placeholder edition for specifying default behaviors *before* a feature
73
+ // was first introduced. This is effectively an "infinite past".
74
+ EDITION_LEGACY = 900;
75
+
76
+ // Legacy syntax "editions". These pre-date editions, but behave much like
77
+ // distinct editions. These can't be used to specify the edition of proto
78
+ // files, but feature definitions must supply proto2/proto3 defaults for
79
+ // backwards compatibility.
80
+ EDITION_PROTO2 = 998;
81
+ EDITION_PROTO3 = 999;
82
+
83
+ // Editions that have been released. The specific values are arbitrary and
84
+ // should not be depended on, but they will always be time-ordered for easy
85
+ // comparison.
86
+ EDITION_2023 = 1000;
87
+ EDITION_2024 = 1001;
88
+
89
+ // Placeholder editions for testing feature resolution. These should not be
90
+ // used or relied on outside of tests.
91
+ EDITION_1_TEST_ONLY = 1;
92
+ EDITION_2_TEST_ONLY = 2;
93
+ EDITION_99997_TEST_ONLY = 99997;
94
+ EDITION_99998_TEST_ONLY = 99998;
95
+ EDITION_99999_TEST_ONLY = 99999;
96
+
97
+ // Placeholder for specifying unbounded edition support. This should only
98
+ // ever be used by plugins that can expect to never require any changes to
99
+ // support a new edition.
100
+ EDITION_MAX = 0x7FFFFFFF;
101
+ }
102
+
103
+ // Describes a complete .proto file.
104
+ message FileDescriptorProto {
105
+ optional string name = 1; // file name, relative to root of source tree
106
+ optional string package = 2; // e.g. "foo", "foo.bar", etc.
107
+
108
+ // Names of files imported by this file.
109
+ repeated string dependency = 3;
110
+ // Indexes of the public imported files in the dependency list above.
111
+ repeated int32 public_dependency = 10;
112
+ // Indexes of the weak imported files in the dependency list.
113
+ // For Google-internal migration only. Do not use.
114
+ repeated int32 weak_dependency = 11;
115
+
116
+ // Names of files imported by this file purely for the purpose of providing
117
+ // option extensions. These are excluded from the dependency list above.
118
+ repeated string option_dependency = 15;
119
+
120
+ // All top-level definitions in this file.
121
+ repeated DescriptorProto message_type = 4;
122
+ repeated EnumDescriptorProto enum_type = 5;
123
+ repeated ServiceDescriptorProto service = 6;
124
+ repeated FieldDescriptorProto extension = 7;
125
+
126
+ optional FileOptions options = 8;
127
+
128
+ // This field contains optional information about the original source code.
129
+ // You may safely remove this entire field without harming runtime
130
+ // functionality of the descriptors -- the information is needed only by
131
+ // development tools.
132
+ optional SourceCodeInfo source_code_info = 9;
133
+
134
+ // The syntax of the proto file.
135
+ // The supported values are "proto2", "proto3", and "editions".
136
+ //
137
+ // If `edition` is present, this value must be "editions".
138
+ // WARNING: This field should only be used by protobuf plugins or special
139
+ // cases like the proto compiler. Other uses are discouraged and
140
+ // developers should rely on the protoreflect APIs for their client language.
141
+ optional string syntax = 12;
142
+
143
+ // The edition of the proto file.
144
+ // WARNING: This field should only be used by protobuf plugins or special
145
+ // cases like the proto compiler. Other uses are discouraged and
146
+ // developers should rely on the protoreflect APIs for their client language.
147
+ optional Edition edition = 14;
148
+ }
149
+
150
+ // Describes a message type.
151
+ message DescriptorProto {
152
+ optional string name = 1;
153
+
154
+ repeated FieldDescriptorProto field = 2;
155
+ repeated FieldDescriptorProto extension = 6;
156
+
157
+ repeated DescriptorProto nested_type = 3;
158
+ repeated EnumDescriptorProto enum_type = 4;
159
+
160
+ message ExtensionRange {
161
+ optional int32 start = 1; // Inclusive.
162
+ optional int32 end = 2; // Exclusive.
163
+
164
+ optional ExtensionRangeOptions options = 3;
165
+ }
166
+ repeated ExtensionRange extension_range = 5;
167
+
168
+ repeated OneofDescriptorProto oneof_decl = 8;
169
+
170
+ optional MessageOptions options = 7;
171
+
172
+ // Range of reserved tag numbers. Reserved tag numbers may not be used by
173
+ // fields or extension ranges in the same message. Reserved ranges may
174
+ // not overlap.
175
+ message ReservedRange {
176
+ optional int32 start = 1; // Inclusive.
177
+ optional int32 end = 2; // Exclusive.
178
+ }
179
+ repeated ReservedRange reserved_range = 9;
180
+ // Reserved field names, which may not be used by fields in the same message.
181
+ // A given name may only be reserved once.
182
+ repeated string reserved_name = 10;
183
+
184
+ // Support for `export` and `local` keywords on enums.
185
+ optional SymbolVisibility visibility = 11;
186
+ }
187
+
188
+ message ExtensionRangeOptions {
189
+ // The parser stores options it doesn't recognize here. See above.
190
+ repeated UninterpretedOption uninterpreted_option = 999;
191
+
192
+ message Declaration {
193
+ // The extension number declared within the extension range.
194
+ optional int32 number = 1;
195
+
196
+ // The fully-qualified name of the extension field. There must be a leading
197
+ // dot in front of the full name.
198
+ optional string full_name = 2;
199
+
200
+ // The fully-qualified type name of the extension field. Unlike
201
+ // Metadata.type, Declaration.type must have a leading dot for messages
202
+ // and enums.
203
+ optional string type = 3;
204
+
205
+ // If true, indicates that the number is reserved in the extension range,
206
+ // and any extension field with the number will fail to compile. Set this
207
+ // when a declared extension field is deleted.
208
+ optional bool reserved = 5;
209
+
210
+ // If true, indicates that the extension must be defined as repeated.
211
+ // Otherwise the extension must be defined as optional.
212
+ optional bool repeated = 6;
213
+
214
+ reserved 4; // removed is_repeated
215
+ }
216
+
217
+ // For external users: DO NOT USE. We are in the process of open sourcing
218
+ // extension declaration and executing internal cleanups before it can be
219
+ // used externally.
220
+ repeated Declaration declaration = 2 [retention = RETENTION_SOURCE];
221
+
222
+ // Any features defined in the specific edition.
223
+ optional FeatureSet features = 50;
224
+
225
+ // The verification state of the extension range.
226
+ enum VerificationState {
227
+ // All the extensions of the range must be declared.
228
+ DECLARATION = 0;
229
+ UNVERIFIED = 1;
230
+ }
231
+
232
+ // The verification state of the range.
233
+ // TODO: flip the default to DECLARATION once all empty ranges
234
+ // are marked as UNVERIFIED.
235
+ optional VerificationState verification = 3
236
+ [default = UNVERIFIED, retention = RETENTION_SOURCE];
237
+
238
+ // Clients can define custom options in extensions of this message. See above.
239
+ extensions 1000 to max;
240
+ }
241
+
242
+ // Describes a field within a message.
243
+ message FieldDescriptorProto {
244
+ enum Type {
245
+ // 0 is reserved for errors.
246
+ // Order is weird for historical reasons.
247
+ TYPE_DOUBLE = 1;
248
+ TYPE_FLOAT = 2;
249
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
250
+ // negative values are likely.
251
+ TYPE_INT64 = 3;
252
+ TYPE_UINT64 = 4;
253
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
254
+ // negative values are likely.
255
+ TYPE_INT32 = 5;
256
+ TYPE_FIXED64 = 6;
257
+ TYPE_FIXED32 = 7;
258
+ TYPE_BOOL = 8;
259
+ TYPE_STRING = 9;
260
+ // Tag-delimited aggregate.
261
+ // Group type is deprecated and not supported after google.protobuf. However, Proto3
262
+ // implementations should still be able to parse the group wire format and
263
+ // treat group fields as unknown fields. In Editions, the group wire format
264
+ // can be enabled via the `message_encoding` feature.
265
+ TYPE_GROUP = 10;
266
+ TYPE_MESSAGE = 11; // Length-delimited aggregate.
267
+
268
+ // New in version 2.
269
+ TYPE_BYTES = 12;
270
+ TYPE_UINT32 = 13;
271
+ TYPE_ENUM = 14;
272
+ TYPE_SFIXED32 = 15;
273
+ TYPE_SFIXED64 = 16;
274
+ TYPE_SINT32 = 17; // Uses ZigZag encoding.
275
+ TYPE_SINT64 = 18; // Uses ZigZag encoding.
276
+ }
277
+
278
+ enum Label {
279
+ // 0 is reserved for errors
280
+ LABEL_OPTIONAL = 1;
281
+ LABEL_REPEATED = 3;
282
+ // The required label is only allowed in google.protobuf. In proto3 and Editions
283
+ // it's explicitly prohibited. In Editions, the `field_presence` feature
284
+ // can be used to get this behavior.
285
+ LABEL_REQUIRED = 2;
286
+ }
287
+
288
+ optional string name = 1;
289
+ optional int32 number = 3;
290
+ optional Label label = 4;
291
+
292
+ // If type_name is set, this need not be set. If both this and type_name
293
+ // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
294
+ optional Type type = 5;
295
+
296
+ // For message and enum types, this is the name of the type. If the name
297
+ // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
298
+ // rules are used to find the type (i.e. first the nested types within this
299
+ // message are searched, then within the parent, on up to the root
300
+ // namespace).
301
+ optional string type_name = 6;
302
+
303
+ // For extensions, this is the name of the type being extended. It is
304
+ // resolved in the same manner as type_name.
305
+ optional string extendee = 2;
306
+
307
+ // For numeric types, contains the original text representation of the value.
308
+ // For booleans, "true" or "false".
309
+ // For strings, contains the default text contents (not escaped in any way).
310
+ // For bytes, contains the C escaped value. All bytes >= 128 are escaped.
311
+ optional string default_value = 7;
312
+
313
+ // If set, gives the index of a oneof in the containing type's oneof_decl
314
+ // list. This field is a member of that oneof.
315
+ optional int32 oneof_index = 9;
316
+
317
+ // JSON name of this field. The value is set by protocol compiler. If the
318
+ // user has set a "json_name" option on this field, that option's value
319
+ // will be used. Otherwise, it's deduced from the field's name by converting
320
+ // it to camelCase.
321
+ optional string json_name = 10;
322
+
323
+ optional FieldOptions options = 8;
324
+
325
+ // If true, this is a proto3 "optional". When a proto3 field is optional, it
326
+ // tracks presence regardless of field type.
327
+ //
328
+ // When proto3_optional is true, this field must belong to a oneof to signal
329
+ // to old proto3 clients that presence is tracked for this field. This oneof
330
+ // is known as a "synthetic" oneof, and this field must be its sole member
331
+ // (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
332
+ // exist in the descriptor only, and do not generate any API. Synthetic oneofs
333
+ // must be ordered after all "real" oneofs.
334
+ //
335
+ // For message fields, proto3_optional doesn't create any semantic change,
336
+ // since non-repeated message fields always track presence. However it still
337
+ // indicates the semantic detail of whether the user wrote "optional" or not.
338
+ // This can be useful for round-tripping the .proto file. For consistency we
339
+ // give message fields a synthetic oneof also, even though it is not required
340
+ // to track presence. This is especially important because the parser can't
341
+ // tell if a field is a message or an enum, so it must always create a
342
+ // synthetic oneof.
343
+ //
344
+ // Proto2 optional fields do not set this flag, because they already indicate
345
+ // optional with `LABEL_OPTIONAL`.
346
+ optional bool proto3_optional = 17;
347
+ }
348
+
349
+ // Describes a oneof.
350
+ message OneofDescriptorProto {
351
+ optional string name = 1;
352
+ optional OneofOptions options = 2;
353
+ }
354
+
355
+ // Describes an enum type.
356
+ message EnumDescriptorProto {
357
+ optional string name = 1;
358
+
359
+ repeated EnumValueDescriptorProto value = 2;
360
+
361
+ optional EnumOptions options = 3;
362
+
363
+ // Range of reserved numeric values. Reserved values may not be used by
364
+ // entries in the same enum. Reserved ranges may not overlap.
365
+ //
366
+ // Note that this is distinct from DescriptorProto.ReservedRange in that it
367
+ // is inclusive such that it can appropriately represent the entire int32
368
+ // domain.
369
+ message EnumReservedRange {
370
+ optional int32 start = 1; // Inclusive.
371
+ optional int32 end = 2; // Inclusive.
372
+ }
373
+
374
+ // Range of reserved numeric values. Reserved numeric values may not be used
375
+ // by enum values in the same enum declaration. Reserved ranges may not
376
+ // overlap.
377
+ repeated EnumReservedRange reserved_range = 4;
378
+
379
+ // Reserved enum value names, which may not be reused. A given name may only
380
+ // be reserved once.
381
+ repeated string reserved_name = 5;
382
+
383
+ // Support for `export` and `local` keywords on enums.
384
+ optional SymbolVisibility visibility = 6;
385
+ }
386
+
387
+ // Describes a value within an enum.
388
+ message EnumValueDescriptorProto {
389
+ optional string name = 1;
390
+ optional int32 number = 2;
391
+
392
+ optional EnumValueOptions options = 3;
393
+ }
394
+
395
+ // Describes a service.
396
+ message ServiceDescriptorProto {
397
+ optional string name = 1;
398
+ repeated MethodDescriptorProto method = 2;
399
+
400
+ optional ServiceOptions options = 3;
401
+ }
402
+
403
+ // Describes a method of a service.
404
+ message MethodDescriptorProto {
405
+ optional string name = 1;
406
+
407
+ // Input and output type names. These are resolved in the same way as
408
+ // FieldDescriptorProto.type_name, but must refer to a message type.
409
+ optional string input_type = 2;
410
+ optional string output_type = 3;
411
+
412
+ optional MethodOptions options = 4;
413
+
414
+ // Identifies if client streams multiple client messages
415
+ optional bool client_streaming = 5 [default = false];
416
+ // Identifies if server streams multiple server messages
417
+ optional bool server_streaming = 6 [default = false];
418
+ }
419
+
420
+ // ===================================================================
421
+ // Options
422
+
423
+ // Each of the definitions above may have "options" attached. These are
424
+ // just annotations which may cause code to be generated slightly differently
425
+ // or may contain hints for code that manipulates protocol messages.
426
+ //
427
+ // Clients may define custom options as extensions of the *Options messages.
428
+ // These extensions may not yet be known at parsing time, so the parser cannot
429
+ // store the values in them. Instead it stores them in a field in the *Options
430
+ // message called uninterpreted_option. This field must have the same name
431
+ // across all *Options messages. We then use this field to populate the
432
+ // extensions when we build a descriptor, at which point all protos have been
433
+ // parsed and so all extensions are known.
434
+ //
435
+ // Extension numbers for custom options may be chosen as follows:
436
+ // * For options which will only be used within a single application or
437
+ // organization, or for experimental options, use field numbers 50000
438
+ // through 99999. It is up to you to ensure that you do not use the
439
+ // same number for multiple options.
440
+ // * For options which will be published and used publicly by multiple
441
+ // independent entities, e-mail protobuf-global-extension-registry@google.com
442
+ // to reserve extension numbers. Simply provide your project name (e.g.
443
+ // Objective-C plugin) and your project website (if available) -- there's no
444
+ // need to explain how you intend to use them. Usually you only need one
445
+ // extension number. You can declare multiple options with only one extension
446
+ // number by putting them in a sub-message. See the Custom Options section of
447
+ // the docs for examples:
448
+ // https://developers.google.com/protocol-buffers/docs/proto#options
449
+ // If this turns out to be popular, a web service will be set up
450
+ // to automatically assign option numbers.
451
+
452
+ message FileOptions {
453
+
454
+ // Sets the Java package where classes generated from this .proto will be
455
+ // placed. By default, the proto package is used, but this is often
456
+ // inappropriate because proto packages do not normally start with backwards
457
+ // domain names.
458
+ optional string java_package = 1;
459
+
460
+ // Controls the name of the wrapper Java class generated for the .proto file.
461
+ // That class will always contain the .proto file's getDescriptor() method as
462
+ // well as any top-level extensions defined in the .proto file.
463
+ // If java_multiple_files is disabled, then all the other classes from the
464
+ // .proto file will be nested inside the single wrapper outer class.
465
+ optional string java_outer_classname = 8;
466
+
467
+ // If enabled, then the Java code generator will generate a separate .java
468
+ // file for each top-level message, enum, and service defined in the .proto
469
+ // file. Thus, these types will *not* be nested inside the wrapper class
470
+ // named by java_outer_classname. However, the wrapper class will still be
471
+ // generated to contain the file's getDescriptor() method as well as any
472
+ // top-level extensions defined in the file.
473
+ optional bool java_multiple_files = 10 [default = false];
474
+
475
+ // This option does nothing.
476
+ optional bool java_generate_equals_and_hash = 20 [deprecated=true];
477
+
478
+ // A proto2 file can set this to true to opt in to UTF-8 checking for Java,
479
+ // which will throw an exception if invalid UTF-8 is parsed from the wire or
480
+ // assigned to a string field.
481
+ //
482
+ // TODO: clarify exactly what kinds of field types this option
483
+ // applies to, and update these docs accordingly.
484
+ //
485
+ // Proto3 files already perform these checks. Setting the option explicitly to
486
+ // false has no effect: it cannot be used to opt proto3 files out of UTF-8
487
+ // checks.
488
+ optional bool java_string_check_utf8 = 27 [default = false];
489
+
490
+ // Generated classes can be optimized for speed or code size.
491
+ enum OptimizeMode {
492
+ SPEED = 1; // Generate complete code for parsing, serialization,
493
+ // etc.
494
+ CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
495
+ LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
496
+ }
497
+ optional OptimizeMode optimize_for = 9 [default = SPEED];
498
+
499
+ // Sets the Go package where structs generated from this .proto will be
500
+ // placed. If omitted, the Go package will be derived from the following:
501
+ // - The basename of the package import path, if provided.
502
+ // - Otherwise, the package statement in the .proto file, if present.
503
+ // - Otherwise, the basename of the .proto file, without extension.
504
+ optional string go_package = 11;
505
+
506
+ // Should generic services be generated in each language? "Generic" services
507
+ // are not specific to any particular RPC system. They are generated by the
508
+ // main code generators in each language (without additional plugins).
509
+ // Generic services were the only kind of service generation supported by
510
+ // early versions of google.protobuf.
511
+ //
512
+ // Generic services are now considered deprecated in favor of using plugins
513
+ // that generate code specific to your particular RPC system. Therefore,
514
+ // these default to false. Old code which depends on generic services should
515
+ // explicitly set them to true.
516
+ optional bool cc_generic_services = 16 [default = false];
517
+ optional bool java_generic_services = 17 [default = false];
518
+ optional bool py_generic_services = 18 [default = false];
519
+ reserved 42; // removed php_generic_services
520
+ reserved "php_generic_services";
521
+
522
+ // Is this file deprecated?
523
+ // Depending on the target platform, this can emit Deprecated annotations
524
+ // for everything in the file, or it will be completely ignored; in the very
525
+ // least, this is a formalization for deprecating files.
526
+ optional bool deprecated = 23 [default = false];
527
+
528
+ // Enables the use of arenas for the proto messages in this file. This applies
529
+ // only to generated classes for C++.
530
+ optional bool cc_enable_arenas = 31 [default = true];
531
+
532
+ // Sets the objective c class prefix which is prepended to all objective c
533
+ // generated classes from this .proto. There is no default.
534
+ optional string objc_class_prefix = 36;
535
+
536
+ // Namespace for generated classes; defaults to the package.
537
+ optional string csharp_namespace = 37;
538
+
539
+ // By default Swift generators will take the proto package and CamelCase it
540
+ // replacing '.' with underscore and use that to prefix the types/symbols
541
+ // defined. When this options is provided, they will use this value instead
542
+ // to prefix the types/symbols defined.
543
+ optional string swift_prefix = 39;
544
+
545
+ // Sets the php class prefix which is prepended to all php generated classes
546
+ // from this .proto. Default is empty.
547
+ optional string php_class_prefix = 40;
548
+
549
+ // Use this option to change the namespace of php generated classes. Default
550
+ // is empty. When this option is empty, the package name will be used for
551
+ // determining the namespace.
552
+ optional string php_namespace = 41;
553
+
554
+ // Use this option to change the namespace of php generated metadata classes.
555
+ // Default is empty. When this option is empty, the proto file name will be
556
+ // used for determining the namespace.
557
+ optional string php_metadata_namespace = 44;
558
+
559
+ // Use this option to change the package of ruby generated classes. Default
560
+ // is empty. When this option is not set, the package name will be used for
561
+ // determining the ruby package.
562
+ optional string ruby_package = 45;
563
+
564
+ // Any features defined in the specific edition.
565
+ // WARNING: This field should only be used by protobuf plugins or special
566
+ // cases like the proto compiler. Other uses are discouraged and
567
+ // developers should rely on the protoreflect APIs for their client language.
568
+ optional FeatureSet features = 50;
569
+
570
+ // The parser stores options it doesn't recognize here.
571
+ // See the documentation for the "Options" section above.
572
+ repeated UninterpretedOption uninterpreted_option = 999;
573
+
574
+ // Clients can define custom options in extensions of this message.
575
+ // See the documentation for the "Options" section above.
576
+ extensions 1000 to max;
577
+
578
+ reserved 38;
579
+ }
580
+
581
+ message MessageOptions {
582
+ // Set true to use the old proto1 MessageSet wire format for extensions.
583
+ // This is provided for backwards-compatibility with the MessageSet wire
584
+ // format. You should not use this for any other reason: It's less
585
+ // efficient, has fewer features, and is more complicated.
586
+ //
587
+ // The message must be defined exactly as follows:
588
+ // message Foo {
589
+ // option message_set_wire_format = true;
590
+ // extensions 4 to max;
591
+ // }
592
+ // Note that the message cannot have any defined fields; MessageSets only
593
+ // have extensions.
594
+ //
595
+ // All extensions of your type must be singular messages; e.g. they cannot
596
+ // be int32s, enums, or repeated messages.
597
+ //
598
+ // Because this is an option, the above two restrictions are not enforced by
599
+ // the protocol compiler.
600
+ optional bool message_set_wire_format = 1 [default = false];
601
+
602
+ // Disables the generation of the standard "descriptor()" accessor, which can
603
+ // conflict with a field of the same name. This is meant to make migration
604
+ // from proto1 easier; new code should avoid fields named "descriptor".
605
+ optional bool no_standard_descriptor_accessor = 2 [default = false];
606
+
607
+ // Is this message deprecated?
608
+ // Depending on the target platform, this can emit Deprecated annotations
609
+ // for the message, or it will be completely ignored; in the very least,
610
+ // this is a formalization for deprecating messages.
611
+ optional bool deprecated = 3 [default = false];
612
+
613
+ reserved 4, 5, 6;
614
+
615
+ // Whether the message is an automatically generated map entry type for the
616
+ // maps field.
617
+ //
618
+ // For maps fields:
619
+ // map<KeyType, ValueType> map_field = 1;
620
+ // The parsed descriptor looks like:
621
+ // message MapFieldEntry {
622
+ // option map_entry = true;
623
+ // optional KeyType key = 1;
624
+ // optional ValueType value = 2;
625
+ // }
626
+ // repeated MapFieldEntry map_field = 1;
627
+ //
628
+ // Implementations may choose not to generate the map_entry=true message, but
629
+ // use a native map in the target language to hold the keys and values.
630
+ // The reflection APIs in such implementations still need to work as
631
+ // if the field is a repeated message field.
632
+ //
633
+ // NOTE: Do not set the option in .proto files. Always use the maps syntax
634
+ // instead. The option should only be implicitly set by the proto compiler
635
+ // parser.
636
+ optional bool map_entry = 7;
637
+
638
+ reserved 8; // javalite_serializable
639
+ reserved 9; // javanano_as_lite
640
+
641
+ // Enable the legacy handling of JSON field name conflicts. This lowercases
642
+ // and strips underscored from the fields before comparison in proto3 only.
643
+ // The new behavior takes `json_name` into account and applies to proto2 as
644
+ // well.
645
+ //
646
+ // This should only be used as a temporary measure against broken builds due
647
+ // to the change in behavior for JSON field name conflicts.
648
+ //
649
+ // TODO This is legacy behavior we plan to remove once downstream
650
+ // teams have had time to migrate.
651
+ optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
652
+
653
+ // Any features defined in the specific edition.
654
+ // WARNING: This field should only be used by protobuf plugins or special
655
+ // cases like the proto compiler. Other uses are discouraged and
656
+ // developers should rely on the protoreflect APIs for their client language.
657
+ optional FeatureSet features = 12;
658
+
659
+ // The parser stores options it doesn't recognize here. See above.
660
+ repeated UninterpretedOption uninterpreted_option = 999;
661
+
662
+ // Clients can define custom options in extensions of this message. See above.
663
+ extensions 1000 to max;
664
+ }
665
+
666
+ message FieldOptions {
667
+ // NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
668
+ // The ctype option instructs the C++ code generator to use a different
669
+ // representation of the field than it normally would. See the specific
670
+ // options below. This option is only implemented to support use of
671
+ // [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
672
+ // type "bytes" in the open source release.
673
+ // TODO: make ctype actually deprecated.
674
+ optional CType ctype = 1 [/*deprecated = true,*/ default = STRING];
675
+ enum CType {
676
+ // Default mode.
677
+ STRING = 0;
678
+
679
+ // The option [ctype=CORD] may be applied to a non-repeated field of type
680
+ // "bytes". It indicates that in C++, the data should be stored in a Cord
681
+ // instead of a string. For very large strings, this may reduce memory
682
+ // fragmentation. It may also allow better performance when parsing from a
683
+ // Cord, or when parsing with aliasing enabled, as the parsed Cord may then
684
+ // alias the original buffer.
685
+ CORD = 1;
686
+
687
+ STRING_PIECE = 2;
688
+ }
689
+ // The packed option can be enabled for repeated primitive fields to enable
690
+ // a more efficient representation on the wire. Rather than repeatedly
691
+ // writing the tag and type for each element, the entire array is encoded as
692
+ // a single length-delimited blob. In proto3, only explicit setting it to
693
+ // false will avoid using packed encoding. This option is prohibited in
694
+ // Editions, but the `repeated_field_encoding` feature can be used to control
695
+ // the behavior.
696
+ optional bool packed = 2;
697
+
698
+ // The jstype option determines the JavaScript type used for values of the
699
+ // field. The option is permitted only for 64 bit integral and fixed types
700
+ // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
701
+ // is represented as JavaScript string, which avoids loss of precision that
702
+ // can happen when a large value is converted to a floating point JavaScript.
703
+ // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
704
+ // use the JavaScript "number" type. The behavior of the default option
705
+ // JS_NORMAL is implementation dependent.
706
+ //
707
+ // This option is an enum to permit additional types to be added, e.g.
708
+ // goog.math.Integer.
709
+ optional JSType jstype = 6 [default = JS_NORMAL];
710
+ enum JSType {
711
+ // Use the default type.
712
+ JS_NORMAL = 0;
713
+
714
+ // Use JavaScript strings.
715
+ JS_STRING = 1;
716
+
717
+ // Use JavaScript numbers.
718
+ JS_NUMBER = 2;
719
+ }
720
+
721
+ // Should this field be parsed lazily? Lazy applies only to message-type
722
+ // fields. It means that when the outer message is initially parsed, the
723
+ // inner message's contents will not be parsed but instead stored in encoded
724
+ // form. The inner message will actually be parsed when it is first accessed.
725
+ //
726
+ // This is only a hint. Implementations are free to choose whether to use
727
+ // eager or lazy parsing regardless of the value of this option. However,
728
+ // setting this option true suggests that the protocol author believes that
729
+ // using lazy parsing on this field is worth the additional bookkeeping
730
+ // overhead typically needed to implement it.
731
+ //
732
+ // This option does not affect the public interface of any generated code;
733
+ // all method signatures remain the same. Furthermore, thread-safety of the
734
+ // interface is not affected by this option; const methods remain safe to
735
+ // call from multiple threads concurrently, while non-const methods continue
736
+ // to require exclusive access.
737
+ //
738
+ // Note that lazy message fields are still eagerly verified to check
739
+ // ill-formed wireformat or missing required fields. Calling IsInitialized()
740
+ // on the outer message would fail if the inner message has missing required
741
+ // fields. Failed verification would result in parsing failure (except when
742
+ // uninitialized messages are acceptable).
743
+ optional bool lazy = 5 [default = false];
744
+
745
+ // unverified_lazy does no correctness checks on the byte stream. This should
746
+ // only be used where lazy with verification is prohibitive for performance
747
+ // reasons.
748
+ optional bool unverified_lazy = 15 [default = false];
749
+
750
+ // Is this field deprecated?
751
+ // Depending on the target platform, this can emit Deprecated annotations
752
+ // for accessors, or it will be completely ignored; in the very least, this
753
+ // is a formalization for deprecating fields.
754
+ optional bool deprecated = 3 [default = false];
755
+
756
+ // For Google-internal migration only. Do not use.
757
+ optional bool weak = 10 [default = false];
758
+
759
+ // Indicate that the field value should not be printed out when using debug
760
+ // formats, e.g. when the field contains sensitive credentials.
761
+ optional bool debug_redact = 16 [default = false];
762
+
763
+ // If set to RETENTION_SOURCE, the option will be omitted from the binary.
764
+ enum OptionRetention {
765
+ RETENTION_UNKNOWN = 0;
766
+ RETENTION_RUNTIME = 1;
767
+ RETENTION_SOURCE = 2;
768
+ }
769
+
770
+ optional OptionRetention retention = 17;
771
+
772
+ // This indicates the types of entities that the field may apply to when used
773
+ // as an option. If it is unset, then the field may be freely used as an
774
+ // option on any kind of entity.
775
+ enum OptionTargetType {
776
+ TARGET_TYPE_UNKNOWN = 0;
777
+ TARGET_TYPE_FILE = 1;
778
+ TARGET_TYPE_EXTENSION_RANGE = 2;
779
+ TARGET_TYPE_MESSAGE = 3;
780
+ TARGET_TYPE_FIELD = 4;
781
+ TARGET_TYPE_ONEOF = 5;
782
+ TARGET_TYPE_ENUM = 6;
783
+ TARGET_TYPE_ENUM_ENTRY = 7;
784
+ TARGET_TYPE_SERVICE = 8;
785
+ TARGET_TYPE_METHOD = 9;
786
+ }
787
+
788
+ repeated OptionTargetType targets = 19;
789
+
790
+ message EditionDefault {
791
+ optional Edition edition = 3;
792
+ optional string value = 2; // Textproto value.
793
+ }
794
+ repeated EditionDefault edition_defaults = 20;
795
+
796
+ // Any features defined in the specific edition.
797
+ // WARNING: This field should only be used by protobuf plugins or special
798
+ // cases like the proto compiler. Other uses are discouraged and
799
+ // developers should rely on the protoreflect APIs for their client language.
800
+ optional FeatureSet features = 21;
801
+
802
+ // Information about the support window of a feature.
803
+ message FeatureSupport {
804
+ // The edition that this feature was first available in. In editions
805
+ // earlier than this one, the default assigned to EDITION_LEGACY will be
806
+ // used, and proto files will not be able to override it.
807
+ optional Edition edition_introduced = 1;
808
+
809
+ // The edition this feature becomes deprecated in. Using this after this
810
+ // edition may trigger warnings.
811
+ optional Edition edition_deprecated = 2;
812
+
813
+ // The deprecation warning text if this feature is used after the edition it
814
+ // was marked deprecated in.
815
+ optional string deprecation_warning = 3;
816
+
817
+ // The edition this feature is no longer available in. In editions after
818
+ // this one, the last default assigned will be used, and proto files will
819
+ // not be able to override it.
820
+ optional Edition edition_removed = 4;
821
+ }
822
+ optional FeatureSupport feature_support = 22;
823
+
824
+ // The parser stores options it doesn't recognize here. See above.
825
+ repeated UninterpretedOption uninterpreted_option = 999;
826
+
827
+ // Clients can define custom options in extensions of this message. See above.
828
+ extensions 1000 to max;
829
+
830
+ reserved 4; // removed jtype
831
+ reserved 18; // reserve target, target_obsolete_do_not_use
832
+ }
833
+
834
+ message OneofOptions {
835
+ // Any features defined in the specific edition.
836
+ // WARNING: This field should only be used by protobuf plugins or special
837
+ // cases like the proto compiler. Other uses are discouraged and
838
+ // developers should rely on the protoreflect APIs for their client language.
839
+ optional FeatureSet features = 1;
840
+
841
+ // The parser stores options it doesn't recognize here. See above.
842
+ repeated UninterpretedOption uninterpreted_option = 999;
843
+
844
+ // Clients can define custom options in extensions of this message. See above.
845
+ extensions 1000 to max;
846
+ }
847
+
848
+ message EnumOptions {
849
+
850
+ // Set this option to true to allow mapping different tag names to the same
851
+ // value.
852
+ optional bool allow_alias = 2;
853
+
854
+ // Is this enum deprecated?
855
+ // Depending on the target platform, this can emit Deprecated annotations
856
+ // for the enum, or it will be completely ignored; in the very least, this
857
+ // is a formalization for deprecating enums.
858
+ optional bool deprecated = 3 [default = false];
859
+
860
+ reserved 5; // javanano_as_lite
861
+
862
+ // Enable the legacy handling of JSON field name conflicts. This lowercases
863
+ // and strips underscored from the fields before comparison in proto3 only.
864
+ // The new behavior takes `json_name` into account and applies to proto2 as
865
+ // well.
866
+ // TODO Remove this legacy behavior once downstream teams have
867
+ // had time to migrate.
868
+ optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
869
+
870
+ // Any features defined in the specific edition.
871
+ // WARNING: This field should only be used by protobuf plugins or special
872
+ // cases like the proto compiler. Other uses are discouraged and
873
+ // developers should rely on the protoreflect APIs for their client language.
874
+ optional FeatureSet features = 7;
875
+
876
+ // The parser stores options it doesn't recognize here. See above.
877
+ repeated UninterpretedOption uninterpreted_option = 999;
878
+
879
+ // Clients can define custom options in extensions of this message. See above.
880
+ extensions 1000 to max;
881
+ }
882
+
883
+ message EnumValueOptions {
884
+ // Is this enum value deprecated?
885
+ // Depending on the target platform, this can emit Deprecated annotations
886
+ // for the enum value, or it will be completely ignored; in the very least,
887
+ // this is a formalization for deprecating enum values.
888
+ optional bool deprecated = 1 [default = false];
889
+
890
+ // Any features defined in the specific edition.
891
+ // WARNING: This field should only be used by protobuf plugins or special
892
+ // cases like the proto compiler. Other uses are discouraged and
893
+ // developers should rely on the protoreflect APIs for their client language.
894
+ optional FeatureSet features = 2;
895
+
896
+ // Indicate that fields annotated with this enum value should not be printed
897
+ // out when using debug formats, e.g. when the field contains sensitive
898
+ // credentials.
899
+ optional bool debug_redact = 3 [default = false];
900
+
901
+ // Information about the support window of a feature value.
902
+ optional FieldOptions.FeatureSupport feature_support = 4;
903
+
904
+ // The parser stores options it doesn't recognize here. See above.
905
+ repeated UninterpretedOption uninterpreted_option = 999;
906
+
907
+ // Clients can define custom options in extensions of this message. See above.
908
+ extensions 1000 to max;
909
+ }
910
+
911
+ message ServiceOptions {
912
+
913
+ // Any features defined in the specific edition.
914
+ // WARNING: This field should only be used by protobuf plugins or special
915
+ // cases like the proto compiler. Other uses are discouraged and
916
+ // developers should rely on the protoreflect APIs for their client language.
917
+ optional FeatureSet features = 34;
918
+
919
+ // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
920
+ // framework. We apologize for hoarding these numbers to ourselves, but
921
+ // we were already using them long before we decided to release Protocol
922
+ // Buffers.
923
+
924
+ // Is this service deprecated?
925
+ // Depending on the target platform, this can emit Deprecated annotations
926
+ // for the service, or it will be completely ignored; in the very least,
927
+ // this is a formalization for deprecating services.
928
+ optional bool deprecated = 33 [default = false];
929
+
930
+ // The parser stores options it doesn't recognize here. See above.
931
+ repeated UninterpretedOption uninterpreted_option = 999;
932
+
933
+ // Clients can define custom options in extensions of this message. See above.
934
+ extensions 1000 to max;
935
+ }
936
+
937
+ message MethodOptions {
938
+
939
+ // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
940
+ // framework. We apologize for hoarding these numbers to ourselves, but
941
+ // we were already using them long before we decided to release Protocol
942
+ // Buffers.
943
+
944
+ // Is this method deprecated?
945
+ // Depending on the target platform, this can emit Deprecated annotations
946
+ // for the method, or it will be completely ignored; in the very least,
947
+ // this is a formalization for deprecating methods.
948
+ optional bool deprecated = 33 [default = false];
949
+
950
+ // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
951
+ // or neither? HTTP based RPC implementation may choose GET verb for safe
952
+ // methods, and PUT verb for idempotent methods instead of the default POST.
953
+ enum IdempotencyLevel {
954
+ IDEMPOTENCY_UNKNOWN = 0;
955
+ NO_SIDE_EFFECTS = 1; // implies idempotent
956
+ IDEMPOTENT = 2; // idempotent, but may have side effects
957
+ }
958
+ optional IdempotencyLevel idempotency_level = 34
959
+ [default = IDEMPOTENCY_UNKNOWN];
960
+
961
+ // Any features defined in the specific edition.
962
+ // WARNING: This field should only be used by protobuf plugins or special
963
+ // cases like the proto compiler. Other uses are discouraged and
964
+ // developers should rely on the protoreflect APIs for their client language.
965
+ optional FeatureSet features = 35;
966
+
967
+ // The parser stores options it doesn't recognize here. See above.
968
+ repeated UninterpretedOption uninterpreted_option = 999;
969
+
970
+ // Clients can define custom options in extensions of this message. See above.
971
+ extensions 1000 to max;
972
+ }
973
+
974
+ // A message representing a option the parser does not recognize. This only
975
+ // appears in options protos created by the compiler::Parser class.
976
+ // DescriptorPool resolves these when building Descriptor objects. Therefore,
977
+ // options protos in descriptor objects (e.g. returned by Descriptor::options(),
978
+ // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
979
+ // in them.
980
+ message UninterpretedOption {
981
+ // The name of the uninterpreted option. Each string represents a segment in
982
+ // a dot-separated name. is_extension is true iff a segment represents an
983
+ // extension (denoted with parentheses in options specs in .proto files).
984
+ // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
985
+ // "foo.(bar.baz).moo".
986
+ message NamePart {
987
+ required string name_part = 1;
988
+ required bool is_extension = 2;
989
+ }
990
+ repeated NamePart name = 2;
991
+
992
+ // The value of the uninterpreted option, in whatever type the tokenizer
993
+ // identified it as during parsing. Exactly one of these should be set.
994
+ optional string identifier_value = 3;
995
+ optional uint64 positive_int_value = 4;
996
+ optional int64 negative_int_value = 5;
997
+ optional double double_value = 6;
998
+ optional bytes string_value = 7;
999
+ optional string aggregate_value = 8;
1000
+ }
1001
+
1002
+ // ===================================================================
1003
+ // Features
1004
+
1005
+ // TODO Enums in C++ gencode (and potentially other languages) are
1006
+ // not well scoped. This means that each of the feature enums below can clash
1007
+ // with each other. The short names we've chosen maximize call-site
1008
+ // readability, but leave us very open to this scenario. A future feature will
1009
+ // be designed and implemented to handle this, hopefully before we ever hit a
1010
+ // conflict here.
1011
+ message FeatureSet {
1012
+ enum FieldPresence {
1013
+ FIELD_PRESENCE_UNKNOWN = 0;
1014
+ EXPLICIT = 1;
1015
+ IMPLICIT = 2;
1016
+ LEGACY_REQUIRED = 3;
1017
+ }
1018
+ optional FieldPresence field_presence = 1 [
1019
+ retention = RETENTION_RUNTIME,
1020
+ targets = TARGET_TYPE_FIELD,
1021
+ targets = TARGET_TYPE_FILE,
1022
+ feature_support = {
1023
+ edition_introduced: EDITION_2023,
1024
+ },
1025
+ edition_defaults = { edition: EDITION_LEGACY, value: "EXPLICIT" },
1026
+ edition_defaults = { edition: EDITION_PROTO3, value: "IMPLICIT" },
1027
+ edition_defaults = { edition: EDITION_2023, value: "EXPLICIT" }
1028
+ ];
1029
+
1030
+ enum EnumType {
1031
+ ENUM_TYPE_UNKNOWN = 0;
1032
+ OPEN = 1;
1033
+ CLOSED = 2;
1034
+ }
1035
+ optional EnumType enum_type = 2 [
1036
+ retention = RETENTION_RUNTIME,
1037
+ targets = TARGET_TYPE_ENUM,
1038
+ targets = TARGET_TYPE_FILE,
1039
+ feature_support = {
1040
+ edition_introduced: EDITION_2023,
1041
+ },
1042
+ edition_defaults = { edition: EDITION_LEGACY, value: "CLOSED" },
1043
+ edition_defaults = { edition: EDITION_PROTO3, value: "OPEN" }
1044
+ ];
1045
+
1046
+ enum RepeatedFieldEncoding {
1047
+ REPEATED_FIELD_ENCODING_UNKNOWN = 0;
1048
+ PACKED = 1;
1049
+ EXPANDED = 2;
1050
+ }
1051
+ optional RepeatedFieldEncoding repeated_field_encoding = 3 [
1052
+ retention = RETENTION_RUNTIME,
1053
+ targets = TARGET_TYPE_FIELD,
1054
+ targets = TARGET_TYPE_FILE,
1055
+ feature_support = {
1056
+ edition_introduced: EDITION_2023,
1057
+ },
1058
+ edition_defaults = { edition: EDITION_LEGACY, value: "EXPANDED" },
1059
+ edition_defaults = { edition: EDITION_PROTO3, value: "PACKED" }
1060
+ ];
1061
+
1062
+ enum Utf8Validation {
1063
+ UTF8_VALIDATION_UNKNOWN = 0;
1064
+ VERIFY = 2;
1065
+ NONE = 3;
1066
+ reserved 1;
1067
+ }
1068
+ optional Utf8Validation utf8_validation = 4 [
1069
+ retention = RETENTION_RUNTIME,
1070
+ targets = TARGET_TYPE_FIELD,
1071
+ targets = TARGET_TYPE_FILE,
1072
+ feature_support = {
1073
+ edition_introduced: EDITION_2023,
1074
+ },
1075
+ edition_defaults = { edition: EDITION_LEGACY, value: "NONE" },
1076
+ edition_defaults = { edition: EDITION_PROTO3, value: "VERIFY" }
1077
+ ];
1078
+
1079
+ enum MessageEncoding {
1080
+ MESSAGE_ENCODING_UNKNOWN = 0;
1081
+ LENGTH_PREFIXED = 1;
1082
+ DELIMITED = 2;
1083
+ }
1084
+ optional MessageEncoding message_encoding = 5 [
1085
+ retention = RETENTION_RUNTIME,
1086
+ targets = TARGET_TYPE_FIELD,
1087
+ targets = TARGET_TYPE_FILE,
1088
+ feature_support = {
1089
+ edition_introduced: EDITION_2023,
1090
+ },
1091
+ edition_defaults = { edition: EDITION_LEGACY, value: "LENGTH_PREFIXED" }
1092
+ ];
1093
+
1094
+ enum JsonFormat {
1095
+ JSON_FORMAT_UNKNOWN = 0;
1096
+ ALLOW = 1;
1097
+ LEGACY_BEST_EFFORT = 2;
1098
+ }
1099
+ optional JsonFormat json_format = 6 [
1100
+ retention = RETENTION_RUNTIME,
1101
+ targets = TARGET_TYPE_MESSAGE,
1102
+ targets = TARGET_TYPE_ENUM,
1103
+ targets = TARGET_TYPE_FILE,
1104
+ feature_support = {
1105
+ edition_introduced: EDITION_2023,
1106
+ },
1107
+ edition_defaults = { edition: EDITION_LEGACY, value: "LEGACY_BEST_EFFORT" },
1108
+ edition_defaults = { edition: EDITION_PROTO3, value: "ALLOW" }
1109
+ ];
1110
+
1111
+ enum EnforceNamingStyle {
1112
+ ENFORCE_NAMING_STYLE_UNKNOWN = 0;
1113
+ STYLE2024 = 1;
1114
+ STYLE_LEGACY = 2;
1115
+ }
1116
+ optional EnforceNamingStyle enforce_naming_style = 7 [
1117
+ retention = RETENTION_SOURCE,
1118
+ targets = TARGET_TYPE_FILE,
1119
+ targets = TARGET_TYPE_EXTENSION_RANGE,
1120
+ targets = TARGET_TYPE_MESSAGE,
1121
+ targets = TARGET_TYPE_FIELD,
1122
+ targets = TARGET_TYPE_ONEOF,
1123
+ targets = TARGET_TYPE_ENUM,
1124
+ targets = TARGET_TYPE_ENUM_ENTRY,
1125
+ targets = TARGET_TYPE_SERVICE,
1126
+ targets = TARGET_TYPE_METHOD,
1127
+ feature_support = {
1128
+ edition_introduced: EDITION_2024,
1129
+ },
1130
+ edition_defaults = { edition: EDITION_LEGACY, value: "STYLE_LEGACY" },
1131
+ edition_defaults = { edition: EDITION_2024, value: "STYLE2024" }
1132
+ ];
1133
+
1134
+ message VisibilityFeature {
1135
+ enum DefaultSymbolVisibility {
1136
+ DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0;
1137
+
1138
+ // Default pre-EDITION_2024, all UNSET visibility are export.
1139
+ EXPORT_ALL = 1;
1140
+
1141
+ // All top-level symbols default to export, nested default to local.
1142
+ EXPORT_TOP_LEVEL = 2;
1143
+
1144
+ // All symbols default to local.
1145
+ LOCAL_ALL = 3;
1146
+
1147
+ // All symbols local by default. Nested types cannot be exported.
1148
+ // With special case caveat for message { enum {} reserved 1 to max; }
1149
+ // This is the recommended setting for new protos.
1150
+ STRICT = 4;
1151
+ }
1152
+ reserved 1 to max;
1153
+ }
1154
+ optional VisibilityFeature.DefaultSymbolVisibility default_symbol_visibility =
1155
+ 8 [
1156
+ retention = RETENTION_SOURCE,
1157
+ targets = TARGET_TYPE_FILE,
1158
+ feature_support = {
1159
+ edition_introduced: EDITION_2024,
1160
+ },
1161
+ edition_defaults = { edition: EDITION_LEGACY, value: "EXPORT_ALL" },
1162
+ edition_defaults = { edition: EDITION_2024, value: "EXPORT_TOP_LEVEL" }
1163
+ ];
1164
+
1165
+ reserved 999;
1166
+
1167
+ extensions 1000 to 9994 [
1168
+ declaration = {
1169
+ number: 1000,
1170
+ full_name: ".pb.cpp",
1171
+ type: ".pb.CppFeatures"
1172
+ },
1173
+ declaration = {
1174
+ number: 1001,
1175
+ full_name: ".pb.java",
1176
+ type: ".pb.JavaFeatures"
1177
+ },
1178
+ declaration = { number: 1002, full_name: ".pb.go", type: ".pb.GoFeatures" },
1179
+ declaration = {
1180
+ number: 1003,
1181
+ full_name: ".pb.python",
1182
+ type: ".pb.PythonFeatures"
1183
+ },
1184
+ declaration = {
1185
+ number: 9990,
1186
+ full_name: ".pb.proto1",
1187
+ type: ".pb.Proto1Features"
1188
+ }
1189
+ ];
1190
+
1191
+ extensions 9995 to 9999; // For internal testing
1192
+ extensions 10000; // for https://github.com/bufbuild/protobuf-es
1193
+ }
1194
+
1195
+ // A compiled specification for the defaults of a set of features. These
1196
+ // messages are generated from FeatureSet extensions and can be used to seed
1197
+ // feature resolution. The resolution with this object becomes a simple search
1198
+ // for the closest matching edition, followed by proto merges.
1199
+ message FeatureSetDefaults {
1200
+ // A map from every known edition with a unique set of defaults to its
1201
+ // defaults. Not all editions may be contained here. For a given edition,
1202
+ // the defaults at the closest matching edition ordered at or before it should
1203
+ // be used. This field must be in strict ascending order by edition.
1204
+ message FeatureSetEditionDefault {
1205
+ optional Edition edition = 3;
1206
+
1207
+ // Defaults of features that can be overridden in this edition.
1208
+ optional FeatureSet overridable_features = 4;
1209
+
1210
+ // Defaults of features that can't be overridden in this edition.
1211
+ optional FeatureSet fixed_features = 5;
1212
+
1213
+ reserved 1, 2;
1214
+ reserved "features";
1215
+ }
1216
+ repeated FeatureSetEditionDefault defaults = 1;
1217
+
1218
+ // The minimum supported edition (inclusive) when this was constructed.
1219
+ // Editions before this will not have defaults.
1220
+ optional Edition minimum_edition = 4;
1221
+
1222
+ // The maximum known edition (inclusive) when this was constructed. Editions
1223
+ // after this will not have reliable defaults.
1224
+ optional Edition maximum_edition = 5;
1225
+ }
1226
+
1227
+ // ===================================================================
1228
+ // Optional source code info
1229
+
1230
+ // Encapsulates information about the original source file from which a
1231
+ // FileDescriptorProto was generated.
1232
+ message SourceCodeInfo {
1233
+ // A Location identifies a piece of source code in a .proto file which
1234
+ // corresponds to a particular definition. This information is intended
1235
+ // to be useful to IDEs, code indexers, documentation generators, and similar
1236
+ // tools.
1237
+ //
1238
+ // For example, say we have a file like:
1239
+ // message Foo {
1240
+ // optional string foo = 1;
1241
+ // }
1242
+ // Let's look at just the field definition:
1243
+ // optional string foo = 1;
1244
+ // ^ ^^ ^^ ^ ^^^
1245
+ // a bc de f ghi
1246
+ // We have the following locations:
1247
+ // span path represents
1248
+ // [a,i) [ 4, 0, 2, 0 ] The whole field definition.
1249
+ // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
1250
+ // [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
1251
+ // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
1252
+ // [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
1253
+ //
1254
+ // Notes:
1255
+ // - A location may refer to a repeated field itself (i.e. not to any
1256
+ // particular index within it). This is used whenever a set of elements are
1257
+ // logically enclosed in a single code segment. For example, an entire
1258
+ // extend block (possibly containing multiple extension definitions) will
1259
+ // have an outer location whose path refers to the "extensions" repeated
1260
+ // field without an index.
1261
+ // - Multiple locations may have the same path. This happens when a single
1262
+ // logical declaration is spread out across multiple places. The most
1263
+ // obvious example is the "extend" block again -- there may be multiple
1264
+ // extend blocks in the same scope, each of which will have the same path.
1265
+ // - A location's span is not always a subset of its parent's span. For
1266
+ // example, the "extendee" of an extension declaration appears at the
1267
+ // beginning of the "extend" block and is shared by all extensions within
1268
+ // the block.
1269
+ // - Just because a location's span is a subset of some other location's span
1270
+ // does not mean that it is a descendant. For example, a "group" defines
1271
+ // both a type and a field in a single declaration. Thus, the locations
1272
+ // corresponding to the type and field and their components will overlap.
1273
+ // - Code which tries to interpret locations should probably be designed to
1274
+ // ignore those that it doesn't understand, as more types of locations could
1275
+ // be recorded in the future.
1276
+ repeated Location location = 1;
1277
+ message Location {
1278
+ // Identifies which part of the FileDescriptorProto was defined at this
1279
+ // location.
1280
+ //
1281
+ // Each element is a field number or an index. They form a path from
1282
+ // the root FileDescriptorProto to the place where the definition appears.
1283
+ // For example, this path:
1284
+ // [ 4, 3, 2, 7, 1 ]
1285
+ // refers to:
1286
+ // file.message_type(3) // 4, 3
1287
+ // .field(7) // 2, 7
1288
+ // .name() // 1
1289
+ // This is because FileDescriptorProto.message_type has field number 4:
1290
+ // repeated DescriptorProto message_type = 4;
1291
+ // and DescriptorProto.field has field number 2:
1292
+ // repeated FieldDescriptorProto field = 2;
1293
+ // and FieldDescriptorProto.name has field number 1:
1294
+ // optional string name = 1;
1295
+ //
1296
+ // Thus, the above path gives the location of a field name. If we removed
1297
+ // the last element:
1298
+ // [ 4, 3, 2, 7 ]
1299
+ // this path refers to the whole field declaration (from the beginning
1300
+ // of the label to the terminating semicolon).
1301
+ repeated int32 path = 1 [packed = true];
1302
+
1303
+ // Always has exactly three or four elements: start line, start column,
1304
+ // end line (optional, otherwise assumed same as start line), end column.
1305
+ // These are packed into a single field for efficiency. Note that line
1306
+ // and column numbers are zero-based -- typically you will want to add
1307
+ // 1 to each before displaying to a user.
1308
+ repeated int32 span = 2 [packed = true];
1309
+
1310
+ // If this SourceCodeInfo represents a complete declaration, these are any
1311
+ // comments appearing before and after the declaration which appear to be
1312
+ // attached to the declaration.
1313
+ //
1314
+ // A series of line comments appearing on consecutive lines, with no other
1315
+ // tokens appearing on those lines, will be treated as a single comment.
1316
+ //
1317
+ // leading_detached_comments will keep paragraphs of comments that appear
1318
+ // before (but not connected to) the current element. Each paragraph,
1319
+ // separated by empty lines, will be one comment element in the repeated
1320
+ // field.
1321
+ //
1322
+ // Only the comment content is provided; comment markers (e.g. //) are
1323
+ // stripped out. For block comments, leading whitespace and an asterisk
1324
+ // will be stripped from the beginning of each line other than the first.
1325
+ // Newlines are included in the output.
1326
+ //
1327
+ // Examples:
1328
+ //
1329
+ // optional int32 foo = 1; // Comment attached to foo.
1330
+ // // Comment attached to bar.
1331
+ // optional int32 bar = 2;
1332
+ //
1333
+ // optional string baz = 3;
1334
+ // // Comment attached to baz.
1335
+ // // Another line attached to baz.
1336
+ //
1337
+ // // Comment attached to moo.
1338
+ // //
1339
+ // // Another line attached to moo.
1340
+ // optional double moo = 4;
1341
+ //
1342
+ // // Detached comment for corge. This is not leading or trailing comments
1343
+ // // to moo or corge because there are blank lines separating it from
1344
+ // // both.
1345
+ //
1346
+ // // Detached comment for corge paragraph 2.
1347
+ //
1348
+ // optional string corge = 5;
1349
+ // /* Block comment attached
1350
+ // * to corge. Leading asterisks
1351
+ // * will be removed. */
1352
+ // /* Block comment attached to
1353
+ // * grault. */
1354
+ // optional int32 grault = 6;
1355
+ //
1356
+ // // ignored detached comments.
1357
+ optional string leading_comments = 3;
1358
+ optional string trailing_comments = 4;
1359
+ repeated string leading_detached_comments = 6;
1360
+ }
1361
+
1362
+ // Extensions for tooling.
1363
+ extensions 536000000 [declaration = {
1364
+ number: 536000000
1365
+ type: ".buf.descriptor.v1.SourceCodeInfoExtension"
1366
+ full_name: ".buf.descriptor.v1.buf_source_code_info_extension"
1367
+ }];
1368
+ }
1369
+
1370
+ // Describes the relationship between generated code and its original source
1371
+ // file. A GeneratedCodeInfo message is associated with only one generated
1372
+ // source file, but may contain references to different source .proto files.
1373
+ message GeneratedCodeInfo {
1374
+ // An Annotation connects some span of text in generated code to an element
1375
+ // of its generating .proto file.
1376
+ repeated Annotation annotation = 1;
1377
+ message Annotation {
1378
+ // Identifies the element in the original source .proto file. This field
1379
+ // is formatted the same as SourceCodeInfo.Location.path.
1380
+ repeated int32 path = 1 [packed = true];
1381
+
1382
+ // Identifies the filesystem path to the original source .proto.
1383
+ optional string source_file = 2;
1384
+
1385
+ // Identifies the starting offset in bytes in the generated code
1386
+ // that relates to the identified object.
1387
+ optional int32 begin = 3;
1388
+
1389
+ // Identifies the ending offset in bytes in the generated code that
1390
+ // relates to the identified object. The end offset should be one past
1391
+ // the last relevant byte (so the length of the text = end - begin).
1392
+ optional int32 end = 4;
1393
+
1394
+ // Represents the identified object's effect on the element in the original
1395
+ // .proto file.
1396
+ enum Semantic {
1397
+ // There is no effect or the effect is indescribable.
1398
+ NONE = 0;
1399
+ // The element is set or otherwise mutated.
1400
+ SET = 1;
1401
+ // An alias to the element is returned.
1402
+ ALIAS = 2;
1403
+ }
1404
+ optional Semantic semantic = 5;
1405
+ }
1406
+ }
1407
+
1408
+ // Describes the 'visibility' of a symbol with respect to the proto import
1409
+ // system. Symbols can only be imported when the visibility rules do not prevent
1410
+ // it (ex: local symbols cannot be imported). Visibility modifiers can only set
1411
+ // on `message` and `enum` as they are the only types available to be referenced
1412
+ // from other files.
1413
+ enum SymbolVisibility {
1414
+ VISIBILITY_UNSET = 0;
1415
+ VISIBILITY_LOCAL = 1;
1416
+ VISIBILITY_EXPORT = 2;
1417
+ }