Debian Codegraph @

third_party/upb/benchmarks/descriptor_sv.proto

raw
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: [email protected] (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 upb_benchmark.sv;
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 // The protocol compiler can output a FileDescriptorSet containing the .proto
51 // files it parses.
52 message FileDescriptorSet {
53 repeated FileDescriptorProto file = 1;
54 }
55
56 // Describes a complete .proto file.
57 message FileDescriptorProto {
58 optional string name = 1
59 [ctype = STRING_PIECE]; // file name, relative to root of source tree
60 optional string package = 2
61 [ctype = STRING_PIECE]; // e.g. "foo", "foo.bar", etc.
62
63 // Names of files imported by this file.
64 repeated string dependency = 3 [ctype = STRING_PIECE];
65 // Indexes of the public imported files in the dependency list above.
66 repeated int32 public_dependency = 10;
67 // Indexes of the weak imported files in the dependency list.
68 // For Google-internal migration only. Do not use.
69 repeated int32 weak_dependency = 11;
70
71 // All top-level definitions in this file.
72 repeated DescriptorProto message_type = 4;
73 repeated EnumDescriptorProto enum_type = 5;
74 repeated ServiceDescriptorProto service = 6;
75 repeated FieldDescriptorProto extension = 7;
76
77 optional FileOptions options = 8;
78
79 // This field contains optional information about the original source code.
80 // You may safely remove this entire field without harming runtime
81 // functionality of the descriptors -- the information is needed only by
82 // development tools.
83 optional SourceCodeInfo source_code_info = 9;
84
85 // The syntax of the proto file.
86 // The supported values are "proto2" and "proto3".
87 optional string syntax = 12 [ctype = STRING_PIECE];
88 }
89
90 // Describes a message type.
91 message DescriptorProto {
92 optional string name = 1 [ctype = STRING_PIECE];
93
94 repeated FieldDescriptorProto field = 2;
95 repeated FieldDescriptorProto extension = 6;
96
97 repeated DescriptorProto nested_type = 3;
98 repeated EnumDescriptorProto enum_type = 4;
99
100 message ExtensionRange {
101 optional int32 start = 1; // Inclusive.
102 optional int32 end = 2; // Exclusive.
103
104 optional ExtensionRangeOptions options = 3;
105 }
106 repeated ExtensionRange extension_range = 5;
107
108 repeated OneofDescriptorProto oneof_decl = 8;
109
110 optional MessageOptions options = 7;
111
112 // Range of reserved tag numbers. Reserved tag numbers may not be used by
113 // fields or extension ranges in the same message. Reserved ranges may
114 // not overlap.
115 message ReservedRange {
116 optional int32 start = 1; // Inclusive.
117 optional int32 end = 2; // Exclusive.
118 }
119 repeated ReservedRange reserved_range = 9;
120 // Reserved field names, which may not be used by fields in the same message.
121 // A given name may only be reserved once.
122 repeated string reserved_name = 10 [ctype = STRING_PIECE];
123 }
124
125 message ExtensionRangeOptions {
126 // The parser stores options it doesn't recognize here. See above.
127 repeated UninterpretedOption uninterpreted_option = 999;
128
129 // Clients can define custom options in extensions of this message. See above.
130 extensions 1000 to max;
131 }
132
133 // Describes a field within a message.
134 message FieldDescriptorProto {
135 enum Type {
136 // 0 is reserved for errors.
137 // Order is weird for historical reasons.
138 TYPE_DOUBLE = 1;
139 TYPE_FLOAT = 2;
140 // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
141 // negative values are likely.
142 TYPE_INT64 = 3;
143 TYPE_UINT64 = 4;
144 // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
145 // negative values are likely.
146 TYPE_INT32 = 5;
147 TYPE_FIXED64 = 6;
148 TYPE_FIXED32 = 7;
149 TYPE_BOOL = 8;
150 TYPE_STRING = 9;
151 // Tag-delimited aggregate.
152 // Group type is deprecated and not supported in proto3. However, Proto3
153 // implementations should still be able to parse the group wire format and
154 // treat group fields as unknown fields.
155 TYPE_GROUP = 10;
156 TYPE_MESSAGE = 11; // Length-delimited aggregate.
157
158 // New in version 2.
159 TYPE_BYTES = 12;
160 TYPE_UINT32 = 13;
161 TYPE_ENUM = 14;
162 TYPE_SFIXED32 = 15;
163 TYPE_SFIXED64 = 16;
164 TYPE_SINT32 = 17; // Uses ZigZag encoding.
165 TYPE_SINT64 = 18; // Uses ZigZag encoding.
166 }
167
168 enum Label {
169 // 0 is reserved for errors
170 LABEL_OPTIONAL = 1;
171 LABEL_REQUIRED = 2;
172 LABEL_REPEATED = 3;
173 }
174
175 optional string name = 1 [ctype = STRING_PIECE];
176 optional int32 number = 3;
177 optional Label label = 4;
178
179 // If type_name is set, this need not be set. If both this and type_name
180 // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
181 optional Type type = 5;
182
183 // For message and enum types, this is the name of the type. If the name
184 // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
185 // rules are used to find the type (i.e. first the nested types within this
186 // message are searched, then within the parent, on up to the root
187 // namespace).
188 optional string type_name = 6 [ctype = STRING_PIECE];
189
190 // For extensions, this is the name of the type being extended. It is
191 // resolved in the same manner as type_name.
192 optional string extendee = 2 [ctype = STRING_PIECE];
193
194 // For numeric types, contains the original text representation of the value.
195 // For booleans, "true" or "false".
196 // For strings, contains the default text contents (not escaped in any way).
197 // For bytes, contains the C escaped value. All bytes >= 128 are escaped.
198 // TODO(kenton): Base-64 encode?
199 optional string default_value = 7 [ctype = STRING_PIECE];
200
201 // If set, gives the index of a oneof in the containing type's oneof_decl
202 // list. This field is a member of that oneof.
203 optional int32 oneof_index = 9;
204
205 // JSON name of this field. The value is set by protocol compiler. If the
206 // user has set a "json_name" option on this field, that option's value
207 // will be used. Otherwise, it's deduced from the field's name by converting
208 // it to camelCase.
209 optional string json_name = 10 [ctype = STRING_PIECE];
210
211 optional FieldOptions options = 8;
212
213 // If true, this is a proto3 "optional". When a proto3 field is optional, it
214 // tracks presence regardless of field type.
215 //
216 // When proto3_optional is true, this field must be belong to a oneof to
217 // signal to old proto3 clients that presence is tracked for this field. This
218 // oneof is known as a "synthetic" oneof, and this field must be its sole
219 // member (each proto3 optional field gets its own synthetic oneof). Synthetic
220 // oneofs exist in the descriptor only, and do not generate any API. Synthetic
221 // oneofs must be ordered after all "real" oneofs.
222 //
223 // For message fields, proto3_optional doesn't create any semantic change,
224 // since non-repeated message fields always track presence. However it still
225 // indicates the semantic detail of whether the user wrote "optional" or not.
226 // This can be useful for round-tripping the .proto file. For consistency we
227 // give message fields a synthetic oneof also, even though it is not required
228 // to track presence. This is especially important because the parser can't
229 // tell if a field is a message or an enum, so it must always create a
230 // synthetic oneof.
231 //
232 // Proto2 optional fields do not set this flag, because they already indicate
233 // optional with `LABEL_OPTIONAL`.
234 optional bool proto3_optional = 17;
235 }
236
237 // Describes a oneof.
238 message OneofDescriptorProto {
239 optional string name = 1 [ctype = STRING_PIECE];
240 optional OneofOptions options = 2;
241 }
242
243 // Describes an enum type.
244 message EnumDescriptorProto {
245 optional string name = 1 [ctype = STRING_PIECE];
246
247 repeated EnumValueDescriptorProto value = 2;
248
249 optional EnumOptions options = 3;
250
251 // Range of reserved numeric values. Reserved values may not be used by
252 // entries in the same enum. Reserved ranges may not overlap.
253 //
254 // Note that this is distinct from DescriptorProto.ReservedRange in that it
255 // is inclusive such that it can appropriately represent the entire int32
256 // domain.
257 message EnumReservedRange {
258 optional int32 start = 1; // Inclusive.
259 optional int32 end = 2; // Inclusive.
260 }
261
262 // Range of reserved numeric values. Reserved numeric values may not be used
263 // by enum values in the same enum declaration. Reserved ranges may not
264 // overlap.
265 repeated EnumReservedRange reserved_range = 4;
266
267 // Reserved enum value names, which may not be reused. A given name may only
268 // be reserved once.
269 repeated string reserved_name = 5 [ctype = STRING_PIECE];
270 }
271
272 // Describes a value within an enum.
273 message EnumValueDescriptorProto {
274 optional string name = 1 [ctype = STRING_PIECE];
275 optional int32 number = 2;
276
277 optional EnumValueOptions options = 3;
278 }
279
280 // Describes a service.
281 message ServiceDescriptorProto {
282 optional string name = 1 [ctype = STRING_PIECE];
283 repeated MethodDescriptorProto method = 2;
284
285 optional ServiceOptions options = 3;
286 }
287
288 // Describes a method of a service.
289 message MethodDescriptorProto {
290 optional string name = 1 [ctype = STRING_PIECE];
291
292 // Input and output type names. These are resolved in the same way as
293 // FieldDescriptorProto.type_name, but must refer to a message type.
294 optional string input_type = 2 [ctype = STRING_PIECE];
295 optional string output_type = 3 [ctype = STRING_PIECE];
296
297 optional MethodOptions options = 4;
298
299 // Identifies if client streams multiple client messages
300 optional bool client_streaming = 5 [default = false];
301 // Identifies if server streams multiple server messages
302 optional bool server_streaming = 6 [default = false];
303 }
304
305 // ===================================================================
306 // Options
307
308 // Each of the definitions above may have "options" attached. These are
309 // just annotations which may cause code to be generated slightly differently
310 // or may contain hints for code that manipulates protocol messages.
311 //
312 // Clients may define custom options as extensions of the *Options messages.
313 // These extensions may not yet be known at parsing time, so the parser cannot
314 // store the values in them. Instead it stores them in a field in the *Options
315 // message called uninterpreted_option. This field must have the same name
316 // across all *Options messages. We then use this field to populate the
317 // extensions when we build a descriptor, at which point all protos have been
318 // parsed and so all extensions are known.
319 //
320 // Extension numbers for custom options may be chosen as follows:
321 // * For options which will only be used within a single application or
322 // organization, or for experimental options, use field numbers 50000
323 // through 99999. It is up to you to ensure that you do not use the
324 // same number for multiple options.
325 // * For options which will be published and used publicly by multiple
326 // independent entities, e-mail [email protected]
327 // to reserve extension numbers. Simply provide your project name (e.g.
328 // Objective-C plugin) and your project website (if available) -- there's no
329 // need to explain how you intend to use them. Usually you only need one
330 // extension number. You can declare multiple options with only one extension
331 // number by putting them in a sub-message. See the Custom Options section of
332 // the docs for examples:
333 // https://developers.google.com/protocol-buffers/docs/proto#options
334 // If this turns out to be popular, a web service will be set up
335 // to automatically assign option numbers.
336
337 message FileOptions {
338 // Sets the Java package where classes generated from this .proto will be
339 // placed. By default, the proto package is used, but this is often
340 // inappropriate because proto packages do not normally start with backwards
341 // domain names.
342 optional string java_package = 1 [ctype = STRING_PIECE];
343
344 // If set, all the classes from the .proto file are wrapped in a single
345 // outer class with the given name. This applies to both Proto1
346 // (equivalent to the old "--one_java_file" option) and Proto2 (where
347 // a .proto always translates to a single class, but you may want to
348 // explicitly choose the class name).
349 optional string java_outer_classname = 8 [ctype = STRING_PIECE];
350
351 // If set true, then the Java code generator will generate a separate .java
352 // file for each top-level message, enum, and service defined in the .proto
353 // file. Thus, these types will *not* be nested inside the outer class
354 // named by java_outer_classname. However, the outer class will still be
355 // generated to contain the file's getDescriptor() method as well as any
356 // top-level extensions defined in the file.
357 optional bool java_multiple_files = 10 [default = false];
358
359 // This option does nothing.
360 optional bool java_generate_equals_and_hash = 20 [deprecated = true];
361
362 // If set true, then the Java2 code generator will generate code that
363 // throws an exception whenever an attempt is made to assign a non-UTF-8
364 // byte sequence to a string field.
365 // Message reflection will do the same.
366 // However, an extension field still accepts non-UTF-8 byte sequences.
367 // This option has no effect on when used with the lite runtime.
368 optional bool java_string_check_utf8 = 27 [default = false];
369
370 // Generated classes can be optimized for speed or code size.
371 enum OptimizeMode {
372 SPEED = 1; // Generate complete code for parsing, serialization,
373 // etc.
374 CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
375 LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
376 }
377 optional OptimizeMode optimize_for = 9 [default = SPEED];
378
379 // Sets the Go package where structs generated from this .proto will be
380 // placed. If omitted, the Go package will be derived from the following:
381 // - The basename of the package import path, if provided.
382 // - Otherwise, the package statement in the .proto file, if present.
383 // - Otherwise, the basename of the .proto file, without extension.
384 optional string go_package = 11 [ctype = STRING_PIECE];
385
386 // Should generic services be generated in each language? "Generic" services
387 // are not specific to any particular RPC system. They are generated by the
388 // main code generators in each language (without additional plugins).
389 // Generic services were the only kind of service generation supported by
390 // early versions of google.protobuf.
391 //
392 // Generic services are now considered deprecated in favor of using plugins
393 // that generate code specific to your particular RPC system. Therefore,
394 // these default to false. Old code which depends on generic services should
395 // explicitly set them to true.
396 optional bool cc_generic_services = 16 [default = false];
397 optional bool java_generic_services = 17 [default = false];
398 optional bool py_generic_services = 18 [default = false];
399 optional bool php_generic_services = 42 [default = false];
400
401 // Is this file deprecated?
402 // Depending on the target platform, this can emit Deprecated annotations
403 // for everything in the file, or it will be completely ignored; in the very
404 // least, this is a formalization for deprecating files.
405 optional bool deprecated = 23 [default = false];
406
407 // Enables the use of arenas for the proto messages in this file. This applies
408 // only to generated classes for C++.
409 optional bool cc_enable_arenas = 31 [default = true];
410
411 // Sets the objective c class prefix which is prepended to all objective c
412 // generated classes from this .proto. There is no default.
413 optional string objc_class_prefix = 36 [ctype = STRING_PIECE];
414
415 // Namespace for generated classes; defaults to the package.
416 optional string csharp_namespace = 37 [ctype = STRING_PIECE];
417
418 // By default Swift generators will take the proto package and CamelCase it
419 // replacing '.' with underscore and use that to prefix the types/symbols
420 // defined. When this options is provided, they will use this value instead
421 // to prefix the types/symbols defined.
422 optional string swift_prefix = 39 [ctype = STRING_PIECE];
423
424 // Sets the php class prefix which is prepended to all php generated classes
425 // from this .proto. Default is empty.
426 optional string php_class_prefix = 40 [ctype = STRING_PIECE];
427
428 // Use this option to change the namespace of php generated classes. Default
429 // is empty. When this option is empty, the package name will be used for
430 // determining the namespace.
431 optional string php_namespace = 41 [ctype = STRING_PIECE];
432
433 // Use this option to change the namespace of php generated metadata classes.
434 // Default is empty. When this option is empty, the proto file name will be
435 // used for determining the namespace.
436 optional string php_metadata_namespace = 44 [ctype = STRING_PIECE];
437
438 // Use this option to change the package of ruby generated classes. Default
439 // is empty. When this option is not set, the package name will be used for
440 // determining the ruby package.
441 optional string ruby_package = 45 [ctype = STRING_PIECE];
442
443 // The parser stores options it doesn't recognize here.
444 // See the documentation for the "Options" section above.
445 repeated UninterpretedOption uninterpreted_option = 999;
446
447 // Clients can define custom options in extensions of this message.
448 // See the documentation for the "Options" section above.
449 extensions 1000 to max;
450
451 reserved 38;
452 }
453
454 message MessageOptions {
455 // Set true to use the old proto1 MessageSet wire format for extensions.
456 // This is provided for backwards-compatibility with the MessageSet wire
457 // format. You should not use this for any other reason: It's less
458 // efficient, has fewer features, and is more complicated.
459 //
460 // The message must be defined exactly as follows:
461 // message Foo {
462 // option message_set_wire_format = true;
463 // extensions 4 to max;
464 // }
465 // Note that the message cannot have any defined fields; MessageSets only
466 // have extensions.
467 //
468 // All extensions of your type must be singular messages; e.g. they cannot
469 // be int32s, enums, or repeated messages.
470 //
471 // Because this is an option, the above two restrictions are not enforced by
472 // the protocol compiler.
473 optional bool message_set_wire_format = 1 [default = false];
474
475 // Disables the generation of the standard "descriptor()" accessor, which can
476 // conflict with a field of the same name. This is meant to make migration
477 // from proto1 easier; new code should avoid fields named "descriptor".
478 optional bool no_standard_descriptor_accessor = 2 [default = false];
479
480 // Is this message deprecated?
481 // Depending on the target platform, this can emit Deprecated annotations
482 // for the message, or it will be completely ignored; in the very least,
483 // this is a formalization for deprecating messages.
484 optional bool deprecated = 3 [default = false];
485
486 // Whether the message is an automatically generated map entry type for the
487 // maps field.
488 //
489 // For maps fields:
490 // map<KeyType, ValueType> map_field = 1;
491 // The parsed descriptor looks like:
492 // message MapFieldEntry {
493 // option map_entry = true;
494 // optional KeyType key = 1;
495 // optional ValueType value = 2;
496 // }
497 // repeated MapFieldEntry map_field = 1;
498 //
499 // Implementations may choose not to generate the map_entry=true message, but
500 // use a native map in the target language to hold the keys and values.
501 // The reflection APIs in such implementations still need to work as
502 // if the field is a repeated message field.
503 //
504 // NOTE: Do not set the option in .proto files. Always use the maps syntax
505 // instead. The option should only be implicitly set by the proto compiler
506 // parser.
507 optional bool map_entry = 7;
508
509 reserved 8; // javalite_serializable
510 reserved 9; // javanano_as_lite
511
512 // The parser stores options it doesn't recognize here. See above.
513 repeated UninterpretedOption uninterpreted_option = 999;
514
515 // Clients can define custom options in extensions of this message. See above.
516 extensions 1000 to max;
517 }
518
519 message FieldOptions {
520 // The ctype option instructs the C++ code generator to use a different
521 // representation of the field than it normally would. See the specific
522 // options below. This option is not yet implemented in the open source
523 // release -- sorry, we'll try to include it in a future version!
524 optional CType ctype = 1 [default = STRING];
525 enum CType {
526 // Default mode.
527 STRING = 0;
528
529 CORD = 1;
530
531 STRING_PIECE = 2;
532 }
533 // The packed option can be enabled for repeated primitive fields to enable
534 // a more efficient representation on the wire. Rather than repeatedly
535 // writing the tag and type for each element, the entire array is encoded as
536 // a single length-delimited blob. In proto3, only explicit setting it to
537 // false will avoid using packed encoding.
538 optional bool packed = 2;
539
540 // The jstype option determines the JavaScript type used for values of the
541 // field. The option is permitted only for 64 bit integral and fixed types
542 // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
543 // is represented as JavaScript string, which avoids loss of precision that
544 // can happen when a large value is converted to a floating point JavaScript.
545 // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
546 // use the JavaScript "number" type. The behavior of the default option
547 // JS_NORMAL is implementation dependent.
548 //
549 // This option is an enum to permit additional types to be added, e.g.
550 // goog.math.Integer.
551 optional JSType jstype = 6 [default = JS_NORMAL];
552 enum JSType {
553 // Use the default type.
554 JS_NORMAL = 0;
555
556 // Use JavaScript strings.
557 JS_STRING = 1;
558
559 // Use JavaScript numbers.
560 JS_NUMBER = 2;
561 }
562
563 // Should this field be parsed lazily? Lazy applies only to message-type
564 // fields. It means that when the outer message is initially parsed, the
565 // inner message's contents will not be parsed but instead stored in encoded
566 // form. The inner message will actually be parsed when it is first accessed.
567 //
568 // This is only a hint. Implementations are free to choose whether to use
569 // eager or lazy parsing regardless of the value of this option. However,
570 // setting this option true suggests that the protocol author believes that
571 // using lazy parsing on this field is worth the additional bookkeeping
572 // overhead typically needed to implement it.
573 //
574 // This option does not affect the public interface of any generated code;
575 // all method signatures remain the same. Furthermore, thread-safety of the
576 // interface is not affected by this option; const methods remain safe to
577 // call from multiple threads concurrently, while non-const methods continue
578 // to require exclusive access.
579 //
580 //
581 // Note that implementations may choose not to check required fields within
582 // a lazy sub-message. That is, calling IsInitialized() on the outer message
583 // may return true even if the inner message has missing required fields.
584 // This is necessary because otherwise the inner message would have to be
585 // parsed in order to perform the check, defeating the purpose of lazy
586 // parsing. An implementation which chooses not to check required fields
587 // must be consistent about it. That is, for any particular sub-message, the
588 // implementation must either *always* check its required fields, or *never*
589 // check its required fields, regardless of whether or not the message has
590 // been parsed.
591 optional bool lazy = 5 [default = false];
592
593 // Is this field deprecated?
594 // Depending on the target platform, this can emit Deprecated annotations
595 // for accessors, or it will be completely ignored; in the very least, this
596 // is a formalization for deprecating fields.
597 optional bool deprecated = 3 [default = false];
598
599 // For Google-internal migration only. Do not use.
600 optional bool weak = 10 [default = false];
601
602 // The parser stores options it doesn't recognize here. See above.
603 repeated UninterpretedOption uninterpreted_option = 999;
604
605 // Clients can define custom options in extensions of this message. See above.
606 extensions 1000 to max;
607
608 reserved 4; // removed jtype
609 }
610
611 message OneofOptions {
612 // The parser stores options it doesn't recognize here. See above.
613 repeated UninterpretedOption uninterpreted_option = 999;
614
615 // Clients can define custom options in extensions of this message. See above.
616 extensions 1000 to max;
617 }
618
619 message EnumOptions {
620 // Set this option to true to allow mapping different tag names to the same
621 // value.
622 optional bool allow_alias = 2;
623
624 // Is this enum deprecated?
625 // Depending on the target platform, this can emit Deprecated annotations
626 // for the enum, or it will be completely ignored; in the very least, this
627 // is a formalization for deprecating enums.
628 optional bool deprecated = 3 [default = false];
629
630 reserved 5; // javanano_as_lite
631
632 // The parser stores options it doesn't recognize here. See above.
633 repeated UninterpretedOption uninterpreted_option = 999;
634
635 // Clients can define custom options in extensions of this message. See above.
636 extensions 1000 to max;
637 }
638
639 message EnumValueOptions {
640 // Is this enum value deprecated?
641 // Depending on the target platform, this can emit Deprecated annotations
642 // for the enum value, or it will be completely ignored; in the very least,
643 // this is a formalization for deprecating enum values.
644 optional bool deprecated = 1 [default = false];
645
646 // The parser stores options it doesn't recognize here. See above.
647 repeated UninterpretedOption uninterpreted_option = 999;
648
649 // Clients can define custom options in extensions of this message. See above.
650 extensions 1000 to max;
651 }
652
653 message ServiceOptions {
654 // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
655 // framework. We apologize for hoarding these numbers to ourselves, but
656 // we were already using them long before we decided to release Protocol
657 // Buffers.
658
659 // Is this service deprecated?
660 // Depending on the target platform, this can emit Deprecated annotations
661 // for the service, or it will be completely ignored; in the very least,
662 // this is a formalization for deprecating services.
663 optional bool deprecated = 33 [default = false];
664
665 // The parser stores options it doesn't recognize here. See above.
666 repeated UninterpretedOption uninterpreted_option = 999;
667
668 // Clients can define custom options in extensions of this message. See above.
669 extensions 1000 to max;
670 }
671
672 message MethodOptions {
673 // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
674 // framework. We apologize for hoarding these numbers to ourselves, but
675 // we were already using them long before we decided to release Protocol
676 // Buffers.
677
678 // Is this method deprecated?
679 // Depending on the target platform, this can emit Deprecated annotations
680 // for the method, or it will be completely ignored; in the very least,
681 // this is a formalization for deprecating methods.
682 optional bool deprecated = 33 [default = false];
683
684 // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
685 // or neither? HTTP based RPC implementation may choose GET verb for safe
686 // methods, and PUT verb for idempotent methods instead of the default POST.
687 enum IdempotencyLevel {
688 IDEMPOTENCY_UNKNOWN = 0;
689 NO_SIDE_EFFECTS = 1; // implies idempotent
690 IDEMPOTENT = 2; // idempotent, but may have side effects
691 }
692 optional IdempotencyLevel idempotency_level = 34
693 [default = IDEMPOTENCY_UNKNOWN];
694
695 // The parser stores options it doesn't recognize here. See above.
696 repeated UninterpretedOption uninterpreted_option = 999;
697
698 // Clients can define custom options in extensions of this message. See above.
699 extensions 1000 to max;
700 }
701
702 // A message representing a option the parser does not recognize. This only
703 // appears in options protos created by the compiler::Parser class.
704 // DescriptorPool resolves these when building Descriptor objects. Therefore,
705 // options protos in descriptor objects (e.g. returned by Descriptor::options(),
706 // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
707 // in them.
708 message UninterpretedOption {
709 // The name of the uninterpreted option. Each string represents a segment in
710 // a dot-separated name. is_extension is true iff a segment represents an
711 // extension (denoted with parentheses in options specs in .proto files).
712 // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
713 // "foo.(bar.baz).qux".
714 message NamePart {
715 optional string name_part = 1 [ctype = STRING_PIECE];
716 optional bool is_extension = 2;
717 }
718 repeated NamePart name = 2;
719
720 // The value of the uninterpreted option, in whatever type the tokenizer
721 // identified it as during parsing. Exactly one of these should be set.
722 optional string identifier_value = 3 [ctype = STRING_PIECE];
723 optional uint64 positive_int_value = 4;
724 optional int64 negative_int_value = 5;
725 optional double double_value = 6;
726 optional bytes string_value = 7;
727 optional string aggregate_value = 8 [ctype = STRING_PIECE];
728 }
729
730 // ===================================================================
731 // Optional source code info
732
733 // Encapsulates information about the original source file from which a
734 // FileDescriptorProto was generated.
735 message SourceCodeInfo {
736 // A Location identifies a piece of source code in a .proto file which
737 // corresponds to a particular definition. This information is intended
738 // to be useful to IDEs, code indexers, documentation generators, and similar
739 // tools.
740 //
741 // For example, say we have a file like:
742 // message Foo {
743 // optional string foo = 1 [ctype = STRING_PIECE];
744 // }
745 // Let's look at just the field definition:
746 // optional string foo = 1 [ctype = STRING_PIECE];
747 // ^ ^^ ^^ ^ ^^^
748 // a bc de f ghi
749 // We have the following locations:
750 // span path represents
751 // [a,i) [ 4, 0, 2, 0 ] The whole field definition.
752 // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
753 // [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
754 // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
755 // [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
756 //
757 // Notes:
758 // - A location may refer to a repeated field itself (i.e. not to any
759 // particular index within it). This is used whenever a set of elements are
760 // logically enclosed in a single code segment. For example, an entire
761 // extend block (possibly containing multiple extension definitions) will
762 // have an outer location whose path refers to the "extensions" repeated
763 // field without an index.
764 // - Multiple locations may have the same path. This happens when a single
765 // logical declaration is spread out across multiple places. The most
766 // obvious example is the "extend" block again -- there may be multiple
767 // extend blocks in the same scope, each of which will have the same path.
768 // - A location's span is not always a subset of its parent's span. For
769 // example, the "extendee" of an extension declaration appears at the
770 // beginning of the "extend" block and is shared by all extensions within
771 // the block.
772 // - Just because a location's span is a subset of some other location's span
773 // does not mean that it is a descendant. For example, a "group" defines
774 // both a type and a field in a single declaration. Thus, the locations
775 // corresponding to the type and field and their components will overlap.
776 // - Code which tries to interpret locations should probably be designed to
777 // ignore those that it doesn't understand, as more types of locations could
778 // be recorded in the future.
779 repeated Location location = 1;
780 message Location {
781 // Identifies which part of the FileDescriptorProto was defined at this
782 // location.
783 //
784 // Each element is a field number or an index. They form a path from
785 // the root FileDescriptorProto to the place where the definition. For
786 // example, this path:
787 // [ 4, 3, 2, 7, 1 ]
788 // refers to:
789 // file.message_type(3) // 4, 3
790 // .field(7) // 2, 7
791 // .name() // 1
792 // This is because FileDescriptorProto.message_type has field number 4:
793 // repeated DescriptorProto message_type = 4;
794 // and DescriptorProto.field has field number 2:
795 // repeated FieldDescriptorProto field = 2;
796 // and FieldDescriptorProto.name has field number 1:
797 // optional string name = 1 [ctype = STRING_PIECE];
798 //
799 // Thus, the above path gives the location of a field name. If we removed
800 // the last element:
801 // [ 4, 3, 2, 7 ]
802 // this path refers to the whole field declaration (from the beginning
803 // of the label to the terminating semicolon).
804 repeated int32 path = 1 [packed = true];
805
806 // Always has exactly three or four elements: start line, start column,
807 // end line (optional, otherwise assumed same as start line), end column.
808 // These are packed into a single field for efficiency. Note that line
809 // and column numbers are zero-based -- typically you will want to add
810 // 1 to each before displaying to a user.
811 repeated int32 span = 2 [packed = true];
812
813 // If this SourceCodeInfo represents a complete declaration, these are any
814 // comments appearing before and after the declaration which appear to be
815 // attached to the declaration.
816 //
817 // A series of line comments appearing on consecutive lines, with no other
818 // tokens appearing on those lines, will be treated as a single comment.
819 //
820 // leading_detached_comments will keep paragraphs of comments that appear
821 // before (but not connected to) the current element. Each paragraph,
822 // separated by empty lines, will be one comment element in the repeated
823 // field.
824 //
825 // Only the comment content is provided; comment markers (e.g. //) are
826 // stripped out. For block comments, leading whitespace and an asterisk
827 // will be stripped from the beginning of each line other than the first.
828 // Newlines are included in the output.
829 //
830 // Examples:
831 //
832 // optional int32 foo = 1; // Comment attached to foo.
833 // // Comment attached to bar.
834 // optional int32 bar = 2;
835 //
836 // optional string baz = 3 [ctype = STRING_PIECE];
837 // // Comment attached to baz.
838 // // Another line attached to baz.
839 //
840 // // Comment attached to qux.
841 // //
842 // // Another line attached to qux.
843 // optional double qux = 4;
844 //
845 // // Detached comment for corge. This is not leading or trailing comments
846 // // to qux or corge because there are blank lines separating it from
847 // // both.
848 //
849 // // Detached comment for corge paragraph 2.
850 //
851 // optional string corge = 5 [ctype = STRING_PIECE];
852 // /* Block comment attached
853 // * to corge. Leading asterisks
854 // * will be removed. */
855 // /* Block comment attached to
856 // * grault. */
857 // optional int32 grault = 6;
858 //
859 // // ignored detached comments.
860 optional string leading_comments = 3 [ctype = STRING_PIECE];
861 optional string trailing_comments = 4 [ctype = STRING_PIECE];
862 repeated string leading_detached_comments = 6 [ctype = STRING_PIECE];
863 }
864 }
865
866 // Describes the relationship between generated code and its original source
867 // file. A GeneratedCodeInfo message is associated with only one generated
868 // source file, but may contain references to different source .proto files.
869 message GeneratedCodeInfo {
870 // An Annotation connects some span of text in generated code to an element
871 // of its generating .proto file.
872 repeated Annotation annotation = 1;
873 message Annotation {
874 // Identifies the element in the original source .proto file. This field
875 // is formatted the same as SourceCodeInfo.Location.path.
876 repeated int32 path = 1 [packed = true];
877
878 // Identifies the filesystem path to the original source .proto.
879 optional string source_file = 2 [ctype = STRING_PIECE];
880
881 // Identifies the starting offset in bytes in the generated code
882 // that relates to the identified object.
883 optional int32 begin = 3;
884
885 // Identifies the ending offset in bytes in the generated code that
886 // relates to the identified offset. The end offset should be one past
887 // the last relevant byte (so the length of the text = end - begin).
888 optional int32 end = 4;
889 }
890 }