github.com/bakjos/protoreflect@v1.9.2/desc/protoprint/testfiles/descriptor-compact.proto (about)

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