github.com/hoveychen/protoreflect@v1.4.7-0.20221103114119-0b4b3385ec76/desc/protoprint/testfiles/descriptor-sorted-AND-multiline-style-comments.proto (about)

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