github.com/bakjos/protoreflect@v1.9.2/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    /*
   256     * If true, this is a proto3 "optional". When a proto3 field is optional, it
   257     * tracks presence regardless of field type.
   258     *
   259     * When proto3_optional is true, this field must be belong to a oneof to
   260     * signal to old proto3 clients that presence is tracked for this field. This
   261     * oneof is known as a "synthetic" oneof, and this field must be its sole
   262     * member (each proto3 optional field gets its own synthetic oneof). Synthetic
   263     * oneofs exist in the descriptor only, and do not generate any API. Synthetic
   264     * oneofs must be ordered after all "real" oneofs.
   265     *
   266     * For message fields, proto3_optional doesn't create any semantic change,
   267     * since non-repeated message fields always track presence. However it still
   268     * indicates the semantic detail of whether the user wrote "optional" or not.
   269     * This can be useful for round-tripping the .proto file. For consistency we
   270     * give message fields a synthetic oneof also, even though it is not required
   271     * to track presence. This is especially important because the parser can't
   272     * tell if a field is a message or an enum, so it must always create a
   273     * synthetic oneof.
   274     *
   275     * Proto2 optional fields do not set this flag, because they already indicate
   276     * optional with `LABEL_OPTIONAL`.
   277     */
   278    optional bool proto3_optional = 17;
   279  
   280    enum Label {
   281      /* 0 is reserved for errors */
   282      LABEL_OPTIONAL = 1;
   283  
   284      LABEL_REQUIRED = 2;
   285  
   286      LABEL_REPEATED = 3;
   287    }
   288  
   289    enum Type {
   290      /*
   291       * 0 is reserved for errors.
   292       * Order is weird for historical reasons.
   293       */
   294      TYPE_DOUBLE = 1;
   295  
   296      TYPE_FLOAT = 2;
   297  
   298      /*
   299       * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
   300       * negative values are likely.
   301       */
   302      TYPE_INT64 = 3;
   303  
   304      TYPE_UINT64 = 4;
   305  
   306      /*
   307       * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
   308       * negative values are likely.
   309       */
   310      TYPE_INT32 = 5;
   311  
   312      TYPE_FIXED64 = 6;
   313  
   314      TYPE_FIXED32 = 7;
   315  
   316      TYPE_BOOL = 8;
   317  
   318      TYPE_STRING = 9;
   319  
   320      /*
   321       * Tag-delimited aggregate.
   322       * Group type is deprecated and not supported in proto3. However, Proto3
   323       * implementations should still be able to parse the group wire format and
   324       * treat group fields as unknown fields.
   325       */
   326      TYPE_GROUP = 10;
   327  
   328      TYPE_MESSAGE = 11; /* Length-delimited aggregate. */
   329  
   330      /* New in version 2. */
   331      TYPE_BYTES = 12;
   332  
   333      TYPE_UINT32 = 13;
   334  
   335      TYPE_ENUM = 14;
   336  
   337      TYPE_SFIXED32 = 15;
   338  
   339      TYPE_SFIXED64 = 16;
   340  
   341      TYPE_SINT32 = 17; /* Uses ZigZag encoding. */
   342  
   343      TYPE_SINT64 = 18; /* Uses ZigZag encoding. */
   344    }
   345  }
   346  
   347  message FieldOptions {
   348    /*
   349     * The ctype option instructs the C++ code generator to use a different
   350     * representation of the field than it normally would.  See the specific
   351     * options below.  This option is not yet implemented in the open source
   352     * release -- sorry, we'll try to include it in a future version!
   353     */
   354    optional CType ctype = 1 [default = STRING];
   355  
   356    /*
   357     * The packed option can be enabled for repeated primitive fields to enable
   358     * a more efficient representation on the wire. Rather than repeatedly
   359     * writing the tag and type for each element, the entire array is encoded as
   360     * a single length-delimited blob. In proto3, only explicit setting it to
   361     * false will avoid using packed encoding.
   362     */
   363    optional bool packed = 2;
   364  
   365    /*
   366     * Is this field deprecated?
   367     * Depending on the target platform, this can emit Deprecated annotations
   368     * for accessors, or it will be completely ignored; in the very least, this
   369     * is a formalization for deprecating fields.
   370     */
   371    optional bool deprecated = 3 [default = false];
   372  
   373    /*
   374     * Should this field be parsed lazily?  Lazy applies only to message-type
   375     * fields.  It means that when the outer message is initially parsed, the
   376     * inner message's contents will not be parsed but instead stored in encoded
   377     * form.  The inner message will actually be parsed when it is first accessed.
   378     *
   379     * This is only a hint.  Implementations are free to choose whether to use
   380     * eager or lazy parsing regardless of the value of this option.  However,
   381     * setting this option true suggests that the protocol author believes that
   382     * using lazy parsing on this field is worth the additional bookkeeping
   383     * overhead typically needed to implement it.
   384     *
   385     * This option does not affect the public interface of any generated code;
   386     * all method signatures remain the same.  Furthermore, thread-safety of the
   387     * interface is not affected by this option; const methods remain safe to
   388     * call from multiple threads concurrently, while non-const methods continue
   389     * to require exclusive access.
   390     *
   391     *
   392     * Note that implementations may choose not to check required fields within
   393     * a lazy sub-message.  That is, calling IsInitialized() on the outer message
   394     * may return true even if the inner message has missing required fields.
   395     * This is necessary because otherwise the inner message would have to be
   396     * parsed in order to perform the check, defeating the purpose of lazy
   397     * parsing.  An implementation which chooses not to check required fields
   398     * must be consistent about it.  That is, for any particular sub-message, the
   399     * implementation must either *always* check its required fields, or *never*
   400     * check its required fields, regardless of whether or not the message has
   401     * been parsed.
   402     */
   403    optional bool lazy = 5 [default = false];
   404  
   405    /*
   406     * The jstype option determines the JavaScript type used for values of the
   407     * field.  The option is permitted only for 64 bit integral and fixed types
   408     * (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING
   409     * is represented as JavaScript string, which avoids loss of precision that
   410     * can happen when a large value is converted to a floating point JavaScript.
   411     * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
   412     * use the JavaScript "number" type.  The behavior of the default option
   413     * JS_NORMAL is implementation dependent.
   414     *
   415     * This option is an enum to permit additional types to be added, e.g.
   416     * goog.math.Integer.
   417     */
   418    optional JSType jstype = 6 [default = JS_NORMAL];
   419  
   420    /* For Google-internal migration only. Do not use. */
   421    optional bool weak = 10 [default = false];
   422  
   423    /* The parser stores options it doesn't recognize here. See above. */
   424    repeated UninterpretedOption uninterpreted_option = 999;
   425  
   426    enum CType {
   427      /* Default mode. */
   428      STRING = 0;
   429  
   430      CORD = 1;
   431  
   432      STRING_PIECE = 2;
   433    }
   434  
   435    enum JSType {
   436      /* Use the default type. */
   437      JS_NORMAL = 0;
   438  
   439      /* Use JavaScript strings. */
   440      JS_STRING = 1;
   441  
   442      /* Use JavaScript numbers. */
   443      JS_NUMBER = 2;
   444    }
   445  
   446    extensions 1000 to max;
   447  
   448    reserved 4;
   449  }
   450  
   451  /* Describes a complete .proto file. */
   452  message FileDescriptorProto {
   453    optional string name = 1; /* file name, relative to root of source tree */
   454  
   455    optional string package = 2; /* e.g. "foo", "foo.bar", etc. */
   456  
   457    /* Names of files imported by this file. */
   458    repeated string dependency = 3;
   459  
   460    /* All top-level definitions in this file. */
   461    repeated DescriptorProto message_type = 4;
   462  
   463    repeated EnumDescriptorProto enum_type = 5;
   464  
   465    repeated ServiceDescriptorProto service = 6;
   466  
   467    repeated FieldDescriptorProto extension = 7;
   468  
   469    optional FileOptions options = 8;
   470  
   471    /*
   472     * This field contains optional information about the original source code.
   473     * You may safely remove this entire field without harming runtime
   474     * functionality of the descriptors -- the information is needed only by
   475     * development tools.
   476     */
   477    optional SourceCodeInfo source_code_info = 9;
   478  
   479    /* Indexes of the public imported files in the dependency list above. */
   480    repeated int32 public_dependency = 10;
   481  
   482    /*
   483     * Indexes of the weak imported files in the dependency list.
   484     * For Google-internal migration only. Do not use.
   485     */
   486    repeated int32 weak_dependency = 11;
   487  
   488    /*
   489     * The syntax of the proto file.
   490     * The supported values are "proto2" and "proto3".
   491     */
   492    optional string syntax = 12;
   493  }
   494  
   495  /*
   496   * The protocol compiler can output a FileDescriptorSet containing the .proto
   497   * files it parses.
   498   */
   499  message FileDescriptorSet {
   500    repeated FileDescriptorProto file = 1;
   501  }
   502  
   503  /*
   504   * ===================================================================
   505   * Options
   506   */
   507  
   508  /*
   509   * Each of the definitions above may have "options" attached.  These are
   510   * just annotations which may cause code to be generated slightly differently
   511   * or may contain hints for code that manipulates protocol messages.
   512   *
   513   * Clients may define custom options as extensions of the *Options messages.
   514   * These extensions may not yet be known at parsing time, so the parser cannot
   515   * store the values in them.  Instead it stores them in a field in the *Options
   516   * message called uninterpreted_option. This field must have the same name
   517   * across all *Options messages. We then use this field to populate the
   518   * extensions when we build a descriptor, at which point all protos have been
   519   * parsed and so all extensions are known.
   520   *
   521   * Extension numbers for custom options may be chosen as follows:
   522   * * For options which will only be used within a single application or
   523   *   organization, or for experimental options, use field numbers 50000
   524   *   through 99999.  It is up to you to ensure that you do not use the
   525   *   same number for multiple options.
   526   * * For options which will be published and used publicly by multiple
   527   *   independent entities, e-mail protobuf-global-extension-registry@google.com
   528   *   to reserve extension numbers. Simply provide your project name (e.g.
   529   *   Objective-C plugin) and your project website (if available) -- there's no
   530   *   need to explain how you intend to use them. Usually you only need one
   531   *   extension number. You can declare multiple options with only one extension
   532   *   number by putting them in a sub-message. See the Custom Options section of
   533   *   the docs for examples:
   534   *   https://developers.google.com/protocol-buffers/docs/proto#options
   535   *   If this turns out to be popular, a web service will be set up
   536   *   to automatically assign option numbers.
   537   */
   538  
   539  message FileOptions {
   540    /*
   541     * Sets the Java package where classes generated from this .proto will be
   542     * placed.  By default, the proto package is used, but this is often
   543     * inappropriate because proto packages do not normally start with backwards
   544     * domain names.
   545     */
   546    optional string java_package = 1;
   547  
   548    /*
   549     * If set, all the classes from the .proto file are wrapped in a single
   550     * outer class with the given name.  This applies to both Proto1
   551     * (equivalent to the old "--one_java_file" option) and Proto2 (where
   552     * a .proto always translates to a single class, but you may want to
   553     * explicitly choose the class name).
   554     */
   555    optional string java_outer_classname = 8;
   556  
   557    optional OptimizeMode optimize_for = 9 [default = SPEED];
   558  
   559    /*
   560     * If set true, then the Java code generator will generate a separate .java
   561     * file for each top-level message, enum, and service defined in the .proto
   562     * file.  Thus, these types will *not* be nested inside the outer class
   563     * named by java_outer_classname.  However, the outer class will still be
   564     * generated to contain the file's getDescriptor() method as well as any
   565     * top-level extensions defined in the file.
   566     */
   567    optional bool java_multiple_files = 10 [default = false];
   568  
   569    /*
   570     * Sets the Go package where structs generated from this .proto will be
   571     * placed. If omitted, the Go package will be derived from the following:
   572     *   - The basename of the package import path, if provided.
   573     *   - Otherwise, the package statement in the .proto file, if present.
   574     *   - Otherwise, the basename of the .proto file, without extension.
   575     */
   576    optional string go_package = 11;
   577  
   578    /*
   579     * Should generic services be generated in each language?  "Generic" services
   580     * are not specific to any particular RPC system.  They are generated by the
   581     * main code generators in each language (without additional plugins).
   582     * Generic services were the only kind of service generation supported by
   583     * early versions of google.protobuf.
   584     *
   585     * Generic services are now considered deprecated in favor of using plugins
   586     * that generate code specific to your particular RPC system.  Therefore,
   587     * these default to false.  Old code which depends on generic services should
   588     * explicitly set them to true.
   589     */
   590    optional bool cc_generic_services = 16 [default = false];
   591  
   592    optional bool java_generic_services = 17 [default = false];
   593  
   594    optional bool py_generic_services = 18 [default = false];
   595  
   596    /* This option does nothing. */
   597    optional bool java_generate_equals_and_hash = 20 [deprecated = true];
   598  
   599    /*
   600     * Is this file deprecated?
   601     * Depending on the target platform, this can emit Deprecated annotations
   602     * for everything in the file, or it will be completely ignored; in the very
   603     * least, this is a formalization for deprecating files.
   604     */
   605    optional bool deprecated = 23 [default = false];
   606  
   607    /*
   608     * If set true, then the Java2 code generator will generate code that
   609     * throws an exception whenever an attempt is made to assign a non-UTF-8
   610     * byte sequence to a string field.
   611     * Message reflection will do the same.
   612     * However, an extension field still accepts non-UTF-8 byte sequences.
   613     * This option has no effect on when used with the lite runtime.
   614     */
   615    optional bool java_string_check_utf8 = 27 [default = false];
   616  
   617    /*
   618     * Enables the use of arenas for the proto messages in this file. This applies
   619     * only to generated classes for C++.
   620     */
   621    optional bool cc_enable_arenas = 31 [default = true];
   622  
   623    /*
   624     * Sets the objective c class prefix which is prepended to all objective c
   625     * generated classes from this .proto. There is no default.
   626     */
   627    optional string objc_class_prefix = 36;
   628  
   629    /* Namespace for generated classes; defaults to the package. */
   630    optional string csharp_namespace = 37;
   631  
   632    /*
   633     * By default Swift generators will take the proto package and CamelCase it
   634     * replacing '.' with underscore and use that to prefix the types/symbols
   635     * defined. When this options is provided, they will use this value instead
   636     * to prefix the types/symbols defined.
   637     */
   638    optional string swift_prefix = 39;
   639  
   640    /*
   641     * Sets the php class prefix which is prepended to all php generated classes
   642     * from this .proto. Default is empty.
   643     */
   644    optional string php_class_prefix = 40;
   645  
   646    /*
   647     * Use this option to change the namespace of php generated classes. Default
   648     * is empty. When this option is empty, the package name will be used for
   649     * determining the namespace.
   650     */
   651    optional string php_namespace = 41;
   652  
   653    optional bool php_generic_services = 42 [default = false];
   654  
   655    /*
   656     * Use this option to change the namespace of php generated metadata classes.
   657     * Default is empty. When this option is empty, the proto file name will be
   658     * used for determining the namespace.
   659     */
   660    optional string php_metadata_namespace = 44;
   661  
   662    /*
   663     * Use this option to change the package of ruby generated classes. Default
   664     * is empty. When this option is not set, the package name will be used for
   665     * determining the ruby package.
   666     */
   667    optional string ruby_package = 45;
   668  
   669    /*
   670     * The parser stores options it doesn't recognize here.
   671     * See the documentation for the "Options" section above.
   672     */
   673    repeated UninterpretedOption uninterpreted_option = 999;
   674  
   675    /* Generated classes can be optimized for speed or code size. */
   676    enum OptimizeMode {
   677      SPEED = 1; /* Generate complete code for parsing, serialization, */
   678  
   679      /* etc. */
   680      CODE_SIZE = 2; /* Use ReflectionOps to implement these methods. */
   681  
   682      LITE_RUNTIME = 3; /* Generate code using MessageLite and the lite runtime. */
   683    }
   684  
   685    extensions 1000 to max;
   686  
   687    reserved 38;
   688  }
   689  
   690  /*
   691   * Describes the relationship between generated code and its original source
   692   * file. A GeneratedCodeInfo message is associated with only one generated
   693   * source file, but may contain references to different source .proto files.
   694   */
   695  message GeneratedCodeInfo {
   696    /*
   697     * An Annotation connects some span of text in generated code to an element
   698     * of its generating .proto file.
   699     */
   700    repeated Annotation annotation = 1;
   701  
   702    message Annotation {
   703      /*
   704       * Identifies the element in the original source .proto file. This field
   705       * is formatted the same as SourceCodeInfo.Location.path.
   706       */
   707      repeated int32 path = 1 [packed = true];
   708  
   709      /* Identifies the filesystem path to the original source .proto. */
   710      optional string source_file = 2;
   711  
   712      /*
   713       * Identifies the starting offset in bytes in the generated code
   714       * that relates to the identified object.
   715       */
   716      optional int32 begin = 3;
   717  
   718      /*
   719       * Identifies the ending offset in bytes in the generated code that
   720       * relates to the identified offset. The end offset should be one past
   721       * the last relevant byte (so the length of the text = end - begin).
   722       */
   723      optional int32 end = 4;
   724    }
   725  }
   726  
   727  message MessageOptions {
   728    /*
   729     * Set true to use the old proto1 MessageSet wire format for extensions.
   730     * This is provided for backwards-compatibility with the MessageSet wire
   731     * format.  You should not use this for any other reason:  It's less
   732     * efficient, has fewer features, and is more complicated.
   733     *
   734     * The message must be defined exactly as follows:
   735     *   message Foo {
   736     *     option message_set_wire_format = true;
   737     *     extensions 4 to max;
   738     *   }
   739     * Note that the message cannot have any defined fields; MessageSets only
   740     * have extensions.
   741     *
   742     * All extensions of your type must be singular messages; e.g. they cannot
   743     * be int32s, enums, or repeated messages.
   744     *
   745     * Because this is an option, the above two restrictions are not enforced by
   746     * the protocol compiler.
   747     */
   748    optional bool message_set_wire_format = 1 [default = false];
   749  
   750    /*
   751     * Disables the generation of the standard "descriptor()" accessor, which can
   752     * conflict with a field of the same name.  This is meant to make migration
   753     * from proto1 easier; new code should avoid fields named "descriptor".
   754     */
   755    optional bool no_standard_descriptor_accessor = 2 [default = false];
   756  
   757    /*
   758     * Is this message deprecated?
   759     * Depending on the target platform, this can emit Deprecated annotations
   760     * for the message, or it will be completely ignored; in the very least,
   761     * this is a formalization for deprecating messages.
   762     */
   763    optional bool deprecated = 3 [default = false];
   764  
   765    /*
   766     * Whether the message is an automatically generated map entry type for the
   767     * maps field.
   768     *
   769     * For maps fields:
   770     *     map<KeyType, ValueType> map_field = 1;
   771     * The parsed descriptor looks like:
   772     *     message MapFieldEntry {
   773     *         option map_entry = true;
   774     *         optional KeyType key = 1;
   775     *         optional ValueType value = 2;
   776     *     }
   777     *     repeated MapFieldEntry map_field = 1;
   778     *
   779     * Implementations may choose not to generate the map_entry=true message, but
   780     * use a native map in the target language to hold the keys and values.
   781     * The reflection APIs in such implementations still need to work as
   782     * if the field is a repeated message field.
   783     *
   784     * NOTE: Do not set the option in .proto files. Always use the maps syntax
   785     * instead. The option should only be implicitly set by the proto compiler
   786     * parser.
   787     */
   788    optional bool map_entry = 7;
   789  
   790    /* The parser stores options it doesn't recognize here. See above. */
   791    repeated UninterpretedOption uninterpreted_option = 999;
   792  
   793    extensions 1000 to max;
   794  
   795    reserved 8, 9;
   796  }
   797  
   798  /* Describes a method of a service. */
   799  message MethodDescriptorProto {
   800    optional string name = 1;
   801  
   802    /*
   803     * Input and output type names.  These are resolved in the same way as
   804     * FieldDescriptorProto.type_name, but must refer to a message type.
   805     */
   806    optional string input_type = 2;
   807  
   808    optional string output_type = 3;
   809  
   810    optional MethodOptions options = 4;
   811  
   812    /* Identifies if client streams multiple client messages */
   813    optional bool client_streaming = 5 [default = false];
   814  
   815    /* Identifies if server streams multiple server messages */
   816    optional bool server_streaming = 6 [default = false];
   817  }
   818  
   819  message MethodOptions {
   820    /*
   821     * Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
   822     *   framework.  We apologize for hoarding these numbers to ourselves, but
   823     *   we were already using them long before we decided to release Protocol
   824     *   Buffers.
   825     */
   826  
   827    /*
   828     * Is this method deprecated?
   829     * Depending on the target platform, this can emit Deprecated annotations
   830     * for the method, or it will be completely ignored; in the very least,
   831     * this is a formalization for deprecating methods.
   832     */
   833    optional bool deprecated = 33 [default = false];
   834  
   835    optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
   836  
   837    /* The parser stores options it doesn't recognize here. See above. */
   838    repeated UninterpretedOption uninterpreted_option = 999;
   839  
   840    /*
   841     * Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
   842     * or neither? HTTP based RPC implementation may choose GET verb for safe
   843     * methods, and PUT verb for idempotent methods instead of the default POST.
   844     */
   845    enum IdempotencyLevel {
   846      IDEMPOTENCY_UNKNOWN = 0;
   847  
   848      NO_SIDE_EFFECTS = 1; /* implies idempotent */
   849  
   850      IDEMPOTENT = 2; /* idempotent, but may have side effects */
   851    }
   852  
   853    extensions 1000 to max;
   854  }
   855  
   856  /* Describes a oneof. */
   857  message OneofDescriptorProto {
   858    optional string name = 1;
   859  
   860    optional OneofOptions options = 2;
   861  }
   862  
   863  message OneofOptions {
   864    /* The parser stores options it doesn't recognize here. See above. */
   865    repeated UninterpretedOption uninterpreted_option = 999;
   866  
   867    extensions 1000 to max;
   868  }
   869  
   870  /* Describes a service. */
   871  message ServiceDescriptorProto {
   872    optional string name = 1;
   873  
   874    repeated MethodDescriptorProto method = 2;
   875  
   876    optional ServiceOptions options = 3;
   877  }
   878  
   879  message ServiceOptions {
   880    /*
   881     * Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
   882     *   framework.  We apologize for hoarding these numbers to ourselves, but
   883     *   we were already using them long before we decided to release Protocol
   884     *   Buffers.
   885     */
   886  
   887    /*
   888     * Is this service deprecated?
   889     * Depending on the target platform, this can emit Deprecated annotations
   890     * for the service, or it will be completely ignored; in the very least,
   891     * this is a formalization for deprecating services.
   892     */
   893    optional bool deprecated = 33 [default = false];
   894  
   895    /* The parser stores options it doesn't recognize here. See above. */
   896    repeated UninterpretedOption uninterpreted_option = 999;
   897  
   898    extensions 1000 to max;
   899  }
   900  
   901  /*
   902   * ===================================================================
   903   * Optional source code info
   904   */
   905  
   906  /*
   907   * Encapsulates information about the original source file from which a
   908   * FileDescriptorProto was generated.
   909   */
   910  message SourceCodeInfo {
   911    /*
   912     * A Location identifies a piece of source code in a .proto file which
   913     * corresponds to a particular definition.  This information is intended
   914     * to be useful to IDEs, code indexers, documentation generators, and similar
   915     * tools.
   916     *
   917     * For example, say we have a file like:
   918     *   message Foo {
   919     *     optional string foo = 1;
   920     *   }
   921     * Let's look at just the field definition:
   922     *   optional string foo = 1;
   923     *   ^       ^^     ^^  ^  ^^^
   924     *   a       bc     de  f  ghi
   925     * We have the following locations:
   926     *   span   path               represents
   927     *   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
   928     *   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
   929     *   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
   930     *   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
   931     *   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
   932     *
   933     * Notes:
   934     * - A location may refer to a repeated field itself (i.e. not to any
   935     *   particular index within it).  This is used whenever a set of elements are
   936     *   logically enclosed in a single code segment.  For example, an entire
   937     *   extend block (possibly containing multiple extension definitions) will
   938     *   have an outer location whose path refers to the "extensions" repeated
   939     *   field without an index.
   940     * - Multiple locations may have the same path.  This happens when a single
   941     *   logical declaration is spread out across multiple places.  The most
   942     *   obvious example is the "extend" block again -- there may be multiple
   943     *   extend blocks in the same scope, each of which will have the same path.
   944     * - A location's span is not always a subset of its parent's span.  For
   945     *   example, the "extendee" of an extension declaration appears at the
   946     *   beginning of the "extend" block and is shared by all extensions within
   947     *   the block.
   948     * - Just because a location's span is a subset of some other location's span
   949     *   does not mean that it is a descendant.  For example, a "group" defines
   950     *   both a type and a field in a single declaration.  Thus, the locations
   951     *   corresponding to the type and field and their components will overlap.
   952     * - Code which tries to interpret locations should probably be designed to
   953     *   ignore those that it doesn't understand, as more types of locations could
   954     *   be recorded in the future.
   955     */
   956    repeated Location location = 1;
   957  
   958    message Location {
   959      /*
   960       * Identifies which part of the FileDescriptorProto was defined at this
   961       * location.
   962       *
   963       * Each element is a field number or an index.  They form a path from
   964       * the root FileDescriptorProto to the place where the definition.  For
   965       * example, this path:
   966       *   [ 4, 3, 2, 7, 1 ]
   967       * refers to:
   968       *   file.message_type(3)  // 4, 3
   969       *       .field(7)         // 2, 7
   970       *       .name()           // 1
   971       * This is because FileDescriptorProto.message_type has field number 4:
   972       *   repeated DescriptorProto message_type = 4;
   973       * and DescriptorProto.field has field number 2:
   974       *   repeated FieldDescriptorProto field = 2;
   975       * and FieldDescriptorProto.name has field number 1:
   976       *   optional string name = 1;
   977       *
   978       * Thus, the above path gives the location of a field name.  If we removed
   979       * the last element:
   980       *   [ 4, 3, 2, 7 ]
   981       * this path refers to the whole field declaration (from the beginning
   982       * of the label to the terminating semicolon).
   983       */
   984      repeated int32 path = 1 [packed = true];
   985  
   986      /*
   987       * Always has exactly three or four elements: start line, start column,
   988       * end line (optional, otherwise assumed same as start line), end column.
   989       * These are packed into a single field for efficiency.  Note that line
   990       * and column numbers are zero-based -- typically you will want to add
   991       * 1 to each before displaying to a user.
   992       */
   993      repeated int32 span = 2 [packed = true];
   994  
   995      // If this SourceCodeInfo represents a complete declaration, these are any
   996      // comments appearing before and after the declaration which appear to be
   997      // attached to the declaration.
   998      //
   999      // A series of line comments appearing on consecutive lines, with no other
  1000      // tokens appearing on those lines, will be treated as a single comment.
  1001      //
  1002      // leading_detached_comments will keep paragraphs of comments that appear
  1003      // before (but not connected to) the current element. Each paragraph,
  1004      // separated by empty lines, will be one comment element in the repeated
  1005      // field.
  1006      //
  1007      // Only the comment content is provided; comment markers (e.g. //) are
  1008      // stripped out.  For block comments, leading whitespace and an asterisk
  1009      // will be stripped from the beginning of each line other than the first.
  1010      // Newlines are included in the output.
  1011      //
  1012      // Examples:
  1013      //
  1014      //   optional int32 foo = 1;  // Comment attached to foo.
  1015      //   // Comment attached to bar.
  1016      //   optional int32 bar = 2;
  1017      //
  1018      //   optional string baz = 3;
  1019      //   // Comment attached to baz.
  1020      //   // Another line attached to baz.
  1021      //
  1022      //   // Comment attached to qux.
  1023      //   //
  1024      //   // Another line attached to qux.
  1025      //   optional double qux = 4;
  1026      //
  1027      //   // Detached comment for corge. This is not leading or trailing comments
  1028      //   // to qux or corge because there are blank lines separating it from
  1029      //   // both.
  1030      //
  1031      //   // Detached comment for corge paragraph 2.
  1032      //
  1033      //   optional string corge = 5;
  1034      //   /* Block comment attached
  1035      //    * to corge.  Leading asterisks
  1036      //    * will be removed. */
  1037      //   /* Block comment attached to
  1038      //    * grault. */
  1039      //   optional int32 grault = 6;
  1040      //
  1041      //   // ignored detached comments.
  1042      optional string leading_comments = 3;
  1043  
  1044      optional string trailing_comments = 4;
  1045  
  1046      repeated string leading_detached_comments = 6;
  1047    }
  1048  }
  1049  
  1050  /*
  1051   * A message representing a option the parser does not recognize. This only
  1052   * appears in options protos created by the compiler::Parser class.
  1053   * DescriptorPool resolves these when building Descriptor objects. Therefore,
  1054   * options protos in descriptor objects (e.g. returned by Descriptor::options(),
  1055   * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
  1056   * in them.
  1057   */
  1058  message UninterpretedOption {
  1059    repeated NamePart name = 2;
  1060  
  1061    /*
  1062     * The value of the uninterpreted option, in whatever type the tokenizer
  1063     * identified it as during parsing. Exactly one of these should be set.
  1064     */
  1065    optional string identifier_value = 3;
  1066  
  1067    optional uint64 positive_int_value = 4;
  1068  
  1069    optional int64 negative_int_value = 5;
  1070  
  1071    optional double double_value = 6;
  1072  
  1073    optional bytes string_value = 7;
  1074  
  1075    optional string aggregate_value = 8;
  1076  
  1077    /*
  1078     * The name of the uninterpreted option.  Each string represents a segment in
  1079     * a dot-separated name.  is_extension is true iff a segment represents an
  1080     * extension (denoted with parentheses in options specs in .proto files).
  1081     * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
  1082     * "foo.(bar.baz).qux".
  1083     */
  1084    message NamePart {
  1085      required string name_part = 1;
  1086  
  1087      required bool is_extension = 2;
  1088    }
  1089  }