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