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