github.com/jhump/protoreflect@v1.16.0/desc/protoprint/testfiles/descriptor-no-trailing-comments.proto (about)

     1  // Protocol Buffers - Google's data interchange format
     2  // Copyright 2008 Google Inc.  All rights reserved.
     3  // https://developers.google.com/protocol-buffers/
     4  //
     5  // Redistribution and use in source and binary forms, with or without
     6  // modification, are permitted provided that the following conditions are
     7  // met:
     8  //
     9  //     * Redistributions of source code must retain the above copyright
    10  // notice, this list of conditions and the following disclaimer.
    11  //     * Redistributions in binary form must reproduce the above
    12  // copyright notice, this list of conditions and the following disclaimer
    13  // in the documentation and/or other materials provided with the
    14  // distribution.
    15  //     * Neither the name of Google Inc. nor the names of its
    16  // contributors may be used to endorse or promote products derived from
    17  // this software without specific prior written permission.
    18  //
    19  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    20  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    21  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    22  // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    23  // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    24  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    25  // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    26  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    27  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    28  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    29  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    30  
    31  // Author: kenton@google.com (Kenton Varda)
    32  //  Based on original Protocol Buffers design by
    33  //  Sanjay Ghemawat, Jeff Dean, and others.
    34  //
    35  // The messages in this file describe the definitions found in .proto files.
    36  // A valid .proto file can be translated directly to a FileDescriptorProto
    37  // without any other information (e.g. without reading its imports).
    38  
    39  syntax = "proto2";
    40  
    41  package google.protobuf;
    42  
    43  option go_package = "google.golang.org/protobuf/types/descriptorpb";
    44  
    45  option java_package = "com.google.protobuf";
    46  
    47  option java_outer_classname = "DescriptorProtos";
    48  
    49  option csharp_namespace = "Google.Protobuf.Reflection";
    50  
    51  option objc_class_prefix = "GPB";
    52  
    53  option cc_enable_arenas = true;
    54  
    55  // descriptor.proto must be optimized for speed because reflection-based
    56  // algorithms don't work during bootstrapping.
    57  option optimize_for = SPEED;
    58  
    59  // The protocol compiler can output a FileDescriptorSet containing the .proto
    60  // files it parses.
    61  message FileDescriptorSet {
    62    repeated FileDescriptorProto file = 1;
    63  }
    64  
    65  // The full set of known editions.
    66  enum Edition {
    67    // A placeholder for an unknown edition value.
    68    EDITION_UNKNOWN = 0;
    69  
    70    // Legacy syntax "editions".  These pre-date editions, but behave much like
    71    // distinct editions.  These can't be used to specify the edition of proto
    72    // files, but feature definitions must supply proto2/proto3 defaults for
    73    // backwards compatibility.
    74    EDITION_PROTO2 = 998;
    75  
    76    EDITION_PROTO3 = 999;
    77  
    78    // Editions that have been released.  The specific values are arbitrary and
    79    // should not be depended on, but they will always be time-ordered for easy
    80    // comparison.
    81    EDITION_2023 = 1000;
    82  
    83    EDITION_2024 = 1001;
    84  
    85    // Placeholder editions for testing feature resolution.  These should not be
    86    // used or relyed on outside of tests.
    87    EDITION_1_TEST_ONLY = 1;
    88  
    89    EDITION_2_TEST_ONLY = 2;
    90  
    91    EDITION_99997_TEST_ONLY = 99997;
    92  
    93    EDITION_99998_TEST_ONLY = 99998;
    94  
    95    EDITION_99999_TEST_ONLY = 99999;
    96  
    97    // Placeholder for specifying unbounded edition support.  This should only
    98    // ever be used by plugins that can expect to never require any changes to
    99    // support a new edition.
   100    EDITION_MAX = 2147483647;
   101  }
   102  
   103  // Describes a complete .proto file.
   104  message FileDescriptorProto {
   105    optional string name = 1;
   106  
   107    optional string package = 2;
   108  
   109    // Names of files imported by this file.
   110    repeated string dependency = 3;
   111  
   112    // Indexes of the public imported files in the dependency list above.
   113    repeated int32 public_dependency = 10;
   114  
   115    // Indexes of the weak imported files in the dependency list.
   116    // For Google-internal migration only. Do not use.
   117    repeated int32 weak_dependency = 11;
   118  
   119    // All top-level definitions in this file.
   120    repeated DescriptorProto message_type = 4;
   121  
   122    repeated EnumDescriptorProto enum_type = 5;
   123  
   124    repeated ServiceDescriptorProto service = 6;
   125  
   126    repeated FieldDescriptorProto extension = 7;
   127  
   128    optional FileOptions options = 8;
   129  
   130    // This field contains optional information about the original source code.
   131    // You may safely remove this entire field without harming runtime
   132    // functionality of the descriptors -- the information is needed only by
   133    // development tools.
   134    optional SourceCodeInfo source_code_info = 9;
   135  
   136    // The syntax of the proto file.
   137    // The supported values are "proto2", "proto3", and "editions".
   138    //
   139    // If `edition` is present, this value must be "editions".
   140    optional string syntax = 12;
   141  
   142    // The edition of the proto file.
   143    optional Edition edition = 14;
   144  }
   145  
   146  // Describes a message type.
   147  message DescriptorProto {
   148    optional string name = 1;
   149  
   150    repeated FieldDescriptorProto field = 2;
   151  
   152    repeated FieldDescriptorProto extension = 6;
   153  
   154    repeated DescriptorProto nested_type = 3;
   155  
   156    repeated EnumDescriptorProto enum_type = 4;
   157  
   158    message ExtensionRange {
   159      optional int32 start = 1;
   160  
   161      optional int32 end = 2;
   162  
   163      optional ExtensionRangeOptions options = 3;
   164    }
   165  
   166    repeated ExtensionRange extension_range = 5;
   167  
   168    repeated OneofDescriptorProto oneof_decl = 8;
   169  
   170    optional MessageOptions options = 7;
   171  
   172    // Range of reserved tag numbers. Reserved tag numbers may not be used by
   173    // fields or extension ranges in the same message. Reserved ranges may
   174    // not overlap.
   175    message ReservedRange {
   176      optional int32 start = 1;
   177  
   178      optional int32 end = 2;
   179    }
   180  
   181    repeated ReservedRange reserved_range = 9;
   182  
   183    // Reserved field names, which may not be used by fields in the same message.
   184    // A given name may only be reserved once.
   185    repeated string reserved_name = 10;
   186  }
   187  
   188  message ExtensionRangeOptions {
   189    // The parser stores options it doesn't recognize here. See above.
   190    repeated UninterpretedOption uninterpreted_option = 999;
   191  
   192    message Declaration {
   193      // The extension number declared within the extension range.
   194      optional int32 number = 1;
   195  
   196      // The fully-qualified name of the extension field. There must be a leading
   197      // dot in front of the full name.
   198      optional string full_name = 2;
   199  
   200      // The fully-qualified type name of the extension field. Unlike
   201      // Metadata.type, Declaration.type must have a leading dot for messages
   202      // and enums.
   203      optional string type = 3;
   204  
   205      // If true, indicates that the number is reserved in the extension range,
   206      // and any extension field with the number will fail to compile. Set this
   207      // when a declared extension field is deleted.
   208      optional bool reserved = 5;
   209  
   210      // If true, indicates that the extension must be defined as repeated.
   211      // Otherwise the extension must be defined as optional.
   212      optional bool repeated = 6;
   213  
   214      reserved 4;
   215    }
   216  
   217    // For external users: DO NOT USE. We are in the process of open sourcing
   218    // extension declaration and executing internal cleanups before it can be
   219    // used externally.
   220    repeated Declaration declaration = 2 [retention = RETENTION_SOURCE];
   221  
   222    // Any features defined in the specific edition.
   223    optional FeatureSet features = 50;
   224  
   225    // The verification state of the extension range.
   226    enum VerificationState {
   227      // All the extensions of the range must be declared.
   228      DECLARATION = 0;
   229  
   230      UNVERIFIED = 1;
   231    }
   232  
   233    // The verification state of the range.
   234    // TODO: flip the default to DECLARATION once all empty ranges
   235    // are marked as UNVERIFIED.
   236    optional VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE];
   237  
   238    extensions 1000 to max;
   239  }
   240  
   241  // Describes a field within a message.
   242  message FieldDescriptorProto {
   243    enum Type {
   244      // 0 is reserved for errors.
   245      // Order is weird for historical reasons.
   246      TYPE_DOUBLE = 1;
   247  
   248      TYPE_FLOAT = 2;
   249  
   250      // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
   251      // negative values are likely.
   252      TYPE_INT64 = 3;
   253  
   254      TYPE_UINT64 = 4;
   255  
   256      // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
   257      // negative values are likely.
   258      TYPE_INT32 = 5;
   259  
   260      TYPE_FIXED64 = 6;
   261  
   262      TYPE_FIXED32 = 7;
   263  
   264      TYPE_BOOL = 8;
   265  
   266      TYPE_STRING = 9;
   267  
   268      // Tag-delimited aggregate.
   269      // Group type is deprecated and not supported after google.protobuf. However, Proto3
   270      // implementations should still be able to parse the group wire format and
   271      // treat group fields as unknown fields.  In Editions, the group wire format
   272      // can be enabled via the `message_encoding` feature.
   273      TYPE_GROUP = 10;
   274  
   275      TYPE_MESSAGE = 11;
   276  
   277      // New in version 2.
   278      TYPE_BYTES = 12;
   279  
   280      TYPE_UINT32 = 13;
   281  
   282      TYPE_ENUM = 14;
   283  
   284      TYPE_SFIXED32 = 15;
   285  
   286      TYPE_SFIXED64 = 16;
   287  
   288      TYPE_SINT32 = 17;
   289  
   290      TYPE_SINT64 = 18;
   291    }
   292  
   293    enum Label {
   294      // 0 is reserved for errors
   295      LABEL_OPTIONAL = 1;
   296  
   297      LABEL_REPEATED = 3;
   298  
   299      // The required label is only allowed in google.protobuf.  In proto3 and Editions
   300      // it's explicitly prohibited.  In Editions, the `field_presence` feature
   301      // can be used to get this behavior.
   302      LABEL_REQUIRED = 2;
   303    }
   304  
   305    optional string name = 1;
   306  
   307    optional int32 number = 3;
   308  
   309    optional Label label = 4;
   310  
   311    // If type_name is set, this need not be set.  If both this and type_name
   312    // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
   313    optional Type type = 5;
   314  
   315    // For message and enum types, this is the name of the type.  If the name
   316    // starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
   317    // rules are used to find the type (i.e. first the nested types within this
   318    // message are searched, then within the parent, on up to the root
   319    // namespace).
   320    optional string type_name = 6;
   321  
   322    // For extensions, this is the name of the type being extended.  It is
   323    // resolved in the same manner as type_name.
   324    optional string extendee = 2;
   325  
   326    // For numeric types, contains the original text representation of the value.
   327    // For booleans, "true" or "false".
   328    // For strings, contains the default text contents (not escaped in any way).
   329    // For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
   330    optional string default_value = 7;
   331  
   332    // If set, gives the index of a oneof in the containing type's oneof_decl
   333    // list.  This field is a member of that oneof.
   334    optional int32 oneof_index = 9;
   335  
   336    // JSON name of this field. The value is set by protocol compiler. If the
   337    // user has set a "json_name" option on this field, that option's value
   338    // will be used. Otherwise, it's deduced from the field's name by converting
   339    // it to camelCase.
   340    optional string json_name = 10;
   341  
   342    optional FieldOptions options = 8;
   343  
   344    // If true, this is a proto3 "optional". When a proto3 field is optional, it
   345    // tracks presence regardless of field type.
   346    //
   347    // When proto3_optional is true, this field must belong to a oneof to signal
   348    // to old proto3 clients that presence is tracked for this field. This oneof
   349    // is known as a "synthetic" oneof, and this field must be its sole member
   350    // (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
   351    // exist in the descriptor only, and do not generate any API. Synthetic oneofs
   352    // must be ordered after all "real" oneofs.
   353    //
   354    // For message fields, proto3_optional doesn't create any semantic change,
   355    // since non-repeated message fields always track presence. However it still
   356    // indicates the semantic detail of whether the user wrote "optional" or not.
   357    // This can be useful for round-tripping the .proto file. For consistency we
   358    // give message fields a synthetic oneof also, even though it is not required
   359    // to track presence. This is especially important because the parser can't
   360    // tell if a field is a message or an enum, so it must always create a
   361    // synthetic oneof.
   362    //
   363    // Proto2 optional fields do not set this flag, because they already indicate
   364    // optional with `LABEL_OPTIONAL`.
   365    optional bool proto3_optional = 17;
   366  }
   367  
   368  // Describes a oneof.
   369  message OneofDescriptorProto {
   370    optional string name = 1;
   371  
   372    optional OneofOptions options = 2;
   373  }
   374  
   375  // Describes an enum type.
   376  message EnumDescriptorProto {
   377    optional string name = 1;
   378  
   379    repeated EnumValueDescriptorProto value = 2;
   380  
   381    optional EnumOptions options = 3;
   382  
   383    // Range of reserved numeric values. Reserved values may not be used by
   384    // entries in the same enum. Reserved ranges may not overlap.
   385    //
   386    // Note that this is distinct from DescriptorProto.ReservedRange in that it
   387    // is inclusive such that it can appropriately represent the entire int32
   388    // domain.
   389    message EnumReservedRange {
   390      optional int32 start = 1;
   391  
   392      optional int32 end = 2;
   393    }
   394  
   395    // Range of reserved numeric values. Reserved numeric values may not be used
   396    // by enum values in the same enum declaration. Reserved ranges may not
   397    // overlap.
   398    repeated EnumReservedRange reserved_range = 4;
   399  
   400    // Reserved enum value names, which may not be reused. A given name may only
   401    // be reserved once.
   402    repeated string reserved_name = 5;
   403  }
   404  
   405  // Describes a value within an enum.
   406  message EnumValueDescriptorProto {
   407    optional string name = 1;
   408  
   409    optional int32 number = 2;
   410  
   411    optional EnumValueOptions options = 3;
   412  }
   413  
   414  // Describes a service.
   415  message ServiceDescriptorProto {
   416    optional string name = 1;
   417  
   418    repeated MethodDescriptorProto method = 2;
   419  
   420    optional ServiceOptions options = 3;
   421  }
   422  
   423  // Describes a method of a service.
   424  message MethodDescriptorProto {
   425    optional string name = 1;
   426  
   427    // Input and output type names.  These are resolved in the same way as
   428    // FieldDescriptorProto.type_name, but must refer to a message type.
   429    optional string input_type = 2;
   430  
   431    optional string output_type = 3;
   432  
   433    optional MethodOptions options = 4;
   434  
   435    // Identifies if client streams multiple client messages
   436    optional bool client_streaming = 5 [default = false];
   437  
   438    // Identifies if server streams multiple server messages
   439    optional bool server_streaming = 6 [default = false];
   440  }
   441  
   442  // ===================================================================
   443  // Options
   444  
   445  // Each of the definitions above may have "options" attached.  These are
   446  // just annotations which may cause code to be generated slightly differently
   447  // or may contain hints for code that manipulates protocol messages.
   448  //
   449  // Clients may define custom options as extensions of the *Options messages.
   450  // These extensions may not yet be known at parsing time, so the parser cannot
   451  // store the values in them.  Instead it stores them in a field in the *Options
   452  // message called uninterpreted_option. This field must have the same name
   453  // across all *Options messages. We then use this field to populate the
   454  // extensions when we build a descriptor, at which point all protos have been
   455  // parsed and so all extensions are known.
   456  //
   457  // Extension numbers for custom options may be chosen as follows:
   458  // * For options which will only be used within a single application or
   459  //   organization, or for experimental options, use field numbers 50000
   460  //   through 99999.  It is up to you to ensure that you do not use the
   461  //   same number for multiple options.
   462  // * For options which will be published and used publicly by multiple
   463  //   independent entities, e-mail protobuf-global-extension-registry@google.com
   464  //   to reserve extension numbers. Simply provide your project name (e.g.
   465  //   Objective-C plugin) and your project website (if available) -- there's no
   466  //   need to explain how you intend to use them. Usually you only need one
   467  //   extension number. You can declare multiple options with only one extension
   468  //   number by putting them in a sub-message. See the Custom Options section of
   469  //   the docs for examples:
   470  //   https://developers.google.com/protocol-buffers/docs/proto#options
   471  //   If this turns out to be popular, a web service will be set up
   472  //   to automatically assign option numbers.
   473  
   474  message FileOptions {
   475    // Sets the Java package where classes generated from this .proto will be
   476    // placed.  By default, the proto package is used, but this is often
   477    // inappropriate because proto packages do not normally start with backwards
   478    // domain names.
   479    optional string java_package = 1;
   480  
   481    // Controls the name of the wrapper Java class generated for the .proto file.
   482    // That class will always contain the .proto file's getDescriptor() method as
   483    // well as any top-level extensions defined in the .proto file.
   484    // If java_multiple_files is disabled, then all the other classes from the
   485    // .proto file will be nested inside the single wrapper outer class.
   486    optional string java_outer_classname = 8;
   487  
   488    // If enabled, then the Java code generator will generate a separate .java
   489    // file for each top-level message, enum, and service defined in the .proto
   490    // file.  Thus, these types will *not* be nested inside the wrapper class
   491    // named by java_outer_classname.  However, the wrapper class will still be
   492    // generated to contain the file's getDescriptor() method as well as any
   493    // top-level extensions defined in the file.
   494    optional bool java_multiple_files = 10 [default = false];
   495  
   496    // This option does nothing.
   497    optional bool java_generate_equals_and_hash = 20 [deprecated = true];
   498  
   499    // If set true, then the Java2 code generator will generate code that
   500    // throws an exception whenever an attempt is made to assign a non-UTF-8
   501    // byte sequence to a string field.
   502    // Message reflection will do the same.
   503    // However, an extension field still accepts non-UTF-8 byte sequences.
   504    // This option has no effect on when used with the lite runtime.
   505    optional bool java_string_check_utf8 = 27 [default = false];
   506  
   507    // Generated classes can be optimized for speed or code size.
   508    enum OptimizeMode {
   509      SPEED = 1;
   510  
   511      // etc.
   512      CODE_SIZE = 2;
   513  
   514      LITE_RUNTIME = 3;
   515    }
   516  
   517    optional OptimizeMode optimize_for = 9 [default = SPEED];
   518  
   519    // Sets the Go package where structs generated from this .proto will be
   520    // placed. If omitted, the Go package will be derived from the following:
   521    //   - The basename of the package import path, if provided.
   522    //   - Otherwise, the package statement in the .proto file, if present.
   523    //   - Otherwise, the basename of the .proto file, without extension.
   524    optional string go_package = 11;
   525  
   526    // Should generic services be generated in each language?  "Generic" services
   527    // are not specific to any particular RPC system.  They are generated by the
   528    // main code generators in each language (without additional plugins).
   529    // Generic services were the only kind of service generation supported by
   530    // early versions of google.protobuf.
   531    //
   532    // Generic services are now considered deprecated in favor of using plugins
   533    // that generate code specific to your particular RPC system.  Therefore,
   534    // these default to false.  Old code which depends on generic services should
   535    // explicitly set them to true.
   536    optional bool cc_generic_services = 16 [default = false];
   537  
   538    optional bool java_generic_services = 17 [default = false];
   539  
   540    optional bool py_generic_services = 18 [default = false];
   541  
   542    reserved 42;
   543  
   544    // Is this file deprecated?
   545    // Depending on the target platform, this can emit Deprecated annotations
   546    // for everything in the file, or it will be completely ignored; in the very
   547    // least, this is a formalization for deprecating files.
   548    optional bool deprecated = 23 [default = false];
   549  
   550    // Enables the use of arenas for the proto messages in this file. This applies
   551    // only to generated classes for C++.
   552    optional bool cc_enable_arenas = 31 [default = true];
   553  
   554    // Sets the objective c class prefix which is prepended to all objective c
   555    // generated classes from this .proto. There is no default.
   556    optional string objc_class_prefix = 36;
   557  
   558    // Namespace for generated classes; defaults to the package.
   559    optional string csharp_namespace = 37;
   560  
   561    // By default Swift generators will take the proto package and CamelCase it
   562    // replacing '.' with underscore and use that to prefix the types/symbols
   563    // defined. When this options is provided, they will use this value instead
   564    // to prefix the types/symbols defined.
   565    optional string swift_prefix = 39;
   566  
   567    // Sets the php class prefix which is prepended to all php generated classes
   568    // from this .proto. Default is empty.
   569    optional string php_class_prefix = 40;
   570  
   571    // Use this option to change the namespace of php generated classes. Default
   572    // is empty. When this option is empty, the package name will be used for
   573    // determining the namespace.
   574    optional string php_namespace = 41;
   575  
   576    // Use this option to change the namespace of php generated metadata classes.
   577    // Default is empty. When this option is empty, the proto file name will be
   578    // used for determining the namespace.
   579    optional string php_metadata_namespace = 44;
   580  
   581    // Use this option to change the package of ruby generated classes. Default
   582    // is empty. When this option is not set, the package name will be used for
   583    // determining the ruby package.
   584    optional string ruby_package = 45;
   585  
   586    // Any features defined in the specific edition.
   587    optional FeatureSet features = 50;
   588  
   589    // The parser stores options it doesn't recognize here.
   590    // See the documentation for the "Options" section above.
   591    repeated UninterpretedOption uninterpreted_option = 999;
   592  
   593    extensions 1000 to max;
   594  
   595    reserved 38;
   596  }
   597  
   598  message MessageOptions {
   599    // Set true to use the old proto1 MessageSet wire format for extensions.
   600    // This is provided for backwards-compatibility with the MessageSet wire
   601    // format.  You should not use this for any other reason:  It's less
   602    // efficient, has fewer features, and is more complicated.
   603    //
   604    // The message must be defined exactly as follows:
   605    //   message Foo {
   606    //     option message_set_wire_format = true;
   607    //     extensions 4 to max;
   608    //   }
   609    // Note that the message cannot have any defined fields; MessageSets only
   610    // have extensions.
   611    //
   612    // All extensions of your type must be singular messages; e.g. they cannot
   613    // be int32s, enums, or repeated messages.
   614    //
   615    // Because this is an option, the above two restrictions are not enforced by
   616    // the protocol compiler.
   617    optional bool message_set_wire_format = 1 [default = false];
   618  
   619    // Disables the generation of the standard "descriptor()" accessor, which can
   620    // conflict with a field of the same name.  This is meant to make migration
   621    // from proto1 easier; new code should avoid fields named "descriptor".
   622    optional bool no_standard_descriptor_accessor = 2 [default = false];
   623  
   624    // Is this message deprecated?
   625    // Depending on the target platform, this can emit Deprecated annotations
   626    // for the message, or it will be completely ignored; in the very least,
   627    // this is a formalization for deprecating messages.
   628    optional bool deprecated = 3 [default = false];
   629  
   630    reserved 4, 5, 6;
   631  
   632    // Whether the message is an automatically generated map entry type for the
   633    // maps field.
   634    //
   635    // For maps fields:
   636    //     map<KeyType, ValueType> map_field = 1;
   637    // The parsed descriptor looks like:
   638    //     message MapFieldEntry {
   639    //         option map_entry = true;
   640    //         optional KeyType key = 1;
   641    //         optional ValueType value = 2;
   642    //     }
   643    //     repeated MapFieldEntry map_field = 1;
   644    //
   645    // Implementations may choose not to generate the map_entry=true message, but
   646    // use a native map in the target language to hold the keys and values.
   647    // The reflection APIs in such implementations still need to work as
   648    // if the field is a repeated message field.
   649    //
   650    // NOTE: Do not set the option in .proto files. Always use the maps syntax
   651    // instead. The option should only be implicitly set by the proto compiler
   652    // parser.
   653    optional bool map_entry = 7;
   654  
   655    reserved 8, 9;
   656  
   657    // Enable the legacy handling of JSON field name conflicts.  This lowercases
   658    // and strips underscored from the fields before comparison in proto3 only.
   659    // The new behavior takes `json_name` into account and applies to proto2 as
   660    // well.
   661    //
   662    // This should only be used as a temporary measure against broken builds due
   663    // to the change in behavior for JSON field name conflicts.
   664    //
   665    // TODO This is legacy behavior we plan to remove once downstream
   666    // teams have had time to migrate.
   667    optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
   668  
   669    // Any features defined in the specific edition.
   670    optional FeatureSet features = 12;
   671  
   672    // The parser stores options it doesn't recognize here. See above.
   673    repeated UninterpretedOption uninterpreted_option = 999;
   674  
   675    extensions 1000 to max;
   676  }
   677  
   678  message FieldOptions {
   679    // The ctype option instructs the C++ code generator to use a different
   680    // representation of the field than it normally would.  See the specific
   681    // options below.  This option is only implemented to support use of
   682    // [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
   683    // type "bytes" in the open source release -- sorry, we'll try to include
   684    // other types in a future version!
   685    optional CType ctype = 1 [default = STRING];
   686  
   687    enum CType {
   688      // Default mode.
   689      STRING = 0;
   690  
   691      // The option [ctype=CORD] may be applied to a non-repeated field of type
   692      // "bytes". It indicates that in C++, the data should be stored in a Cord
   693      // instead of a string.  For very large strings, this may reduce memory
   694      // fragmentation. It may also allow better performance when parsing from a
   695      // Cord, or when parsing with aliasing enabled, as the parsed Cord may then
   696      // alias the original buffer.
   697      CORD = 1;
   698  
   699      STRING_PIECE = 2;
   700    }
   701  
   702    // The packed option can be enabled for repeated primitive fields to enable
   703    // a more efficient representation on the wire. Rather than repeatedly
   704    // writing the tag and type for each element, the entire array is encoded as
   705    // a single length-delimited blob. In proto3, only explicit setting it to
   706    // false will avoid using packed encoding.  This option is prohibited in
   707    // Editions, but the `repeated_field_encoding` feature can be used to control
   708    // the behavior.
   709    optional bool packed = 2;
   710  
   711    // The jstype option determines the JavaScript type used for values of the
   712    // field.  The option is permitted only for 64 bit integral and fixed types
   713    // (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING
   714    // is represented as JavaScript string, which avoids loss of precision that
   715    // can happen when a large value is converted to a floating point JavaScript.
   716    // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
   717    // use the JavaScript "number" type.  The behavior of the default option
   718    // JS_NORMAL is implementation dependent.
   719    //
   720    // This option is an enum to permit additional types to be added, e.g.
   721    // goog.math.Integer.
   722    optional JSType jstype = 6 [default = JS_NORMAL];
   723  
   724    enum JSType {
   725      // Use the default type.
   726      JS_NORMAL = 0;
   727  
   728      // Use JavaScript strings.
   729      JS_STRING = 1;
   730  
   731      // Use JavaScript numbers.
   732      JS_NUMBER = 2;
   733    }
   734  
   735    // Should this field be parsed lazily?  Lazy applies only to message-type
   736    // fields.  It means that when the outer message is initially parsed, the
   737    // inner message's contents will not be parsed but instead stored in encoded
   738    // form.  The inner message will actually be parsed when it is first accessed.
   739    //
   740    // This is only a hint.  Implementations are free to choose whether to use
   741    // eager or lazy parsing regardless of the value of this option.  However,
   742    // setting this option true suggests that the protocol author believes that
   743    // using lazy parsing on this field is worth the additional bookkeeping
   744    // overhead typically needed to implement it.
   745    //
   746    // This option does not affect the public interface of any generated code;
   747    // all method signatures remain the same.  Furthermore, thread-safety of the
   748    // interface is not affected by this option; const methods remain safe to
   749    // call from multiple threads concurrently, while non-const methods continue
   750    // to require exclusive access.
   751    //
   752    // Note that lazy message fields are still eagerly verified to check
   753    // ill-formed wireformat or missing required fields. Calling IsInitialized()
   754    // on the outer message would fail if the inner message has missing required
   755    // fields. Failed verification would result in parsing failure (except when
   756    // uninitialized messages are acceptable).
   757    optional bool lazy = 5 [default = false];
   758  
   759    // unverified_lazy does no correctness checks on the byte stream. This should
   760    // only be used where lazy with verification is prohibitive for performance
   761    // reasons.
   762    optional bool unverified_lazy = 15 [default = false];
   763  
   764    // Is this field deprecated?
   765    // Depending on the target platform, this can emit Deprecated annotations
   766    // for accessors, or it will be completely ignored; in the very least, this
   767    // is a formalization for deprecating fields.
   768    optional bool deprecated = 3 [default = false];
   769  
   770    // For Google-internal migration only. Do not use.
   771    optional bool weak = 10 [default = false];
   772  
   773    // Indicate that the field value should not be printed out when using debug
   774    // formats, e.g. when the field contains sensitive credentials.
   775    optional bool debug_redact = 16 [default = false];
   776  
   777    // If set to RETENTION_SOURCE, the option will be omitted from the binary.
   778    // Note: as of January 2023, support for this is in progress and does not yet
   779    // have an effect (b/264593489).
   780    enum OptionRetention {
   781      RETENTION_UNKNOWN = 0;
   782  
   783      RETENTION_RUNTIME = 1;
   784  
   785      RETENTION_SOURCE = 2;
   786    }
   787  
   788    optional OptionRetention retention = 17;
   789  
   790    // This indicates the types of entities that the field may apply to when used
   791    // as an option. If it is unset, then the field may be freely used as an
   792    // option on any kind of entity. Note: as of January 2023, support for this is
   793    // in progress and does not yet have an effect (b/264593489).
   794    enum OptionTargetType {
   795      TARGET_TYPE_UNKNOWN = 0;
   796  
   797      TARGET_TYPE_FILE = 1;
   798  
   799      TARGET_TYPE_EXTENSION_RANGE = 2;
   800  
   801      TARGET_TYPE_MESSAGE = 3;
   802  
   803      TARGET_TYPE_FIELD = 4;
   804  
   805      TARGET_TYPE_ONEOF = 5;
   806  
   807      TARGET_TYPE_ENUM = 6;
   808  
   809      TARGET_TYPE_ENUM_ENTRY = 7;
   810  
   811      TARGET_TYPE_SERVICE = 8;
   812  
   813      TARGET_TYPE_METHOD = 9;
   814    }
   815  
   816    repeated OptionTargetType targets = 19;
   817  
   818    message EditionDefault {
   819      optional Edition edition = 3;
   820  
   821      optional string value = 2;
   822    }
   823  
   824    repeated EditionDefault edition_defaults = 20;
   825  
   826    // Any features defined in the specific edition.
   827    optional FeatureSet features = 21;
   828  
   829    // The parser stores options it doesn't recognize here. See above.
   830    repeated UninterpretedOption uninterpreted_option = 999;
   831  
   832    extensions 1000 to max;
   833  
   834    reserved 4, 18;
   835  }
   836  
   837  message OneofOptions {
   838    // Any features defined in the specific edition.
   839    optional FeatureSet features = 1;
   840  
   841    // The parser stores options it doesn't recognize here. See above.
   842    repeated UninterpretedOption uninterpreted_option = 999;
   843  
   844    extensions 1000 to max;
   845  }
   846  
   847  message EnumOptions {
   848    // Set this option to true to allow mapping different tag names to the same
   849    // value.
   850    optional bool allow_alias = 2;
   851  
   852    // Is this enum deprecated?
   853    // Depending on the target platform, this can emit Deprecated annotations
   854    // for the enum, or it will be completely ignored; in the very least, this
   855    // is a formalization for deprecating enums.
   856    optional bool deprecated = 3 [default = false];
   857  
   858    reserved 5;
   859  
   860    // Enable the legacy handling of JSON field name conflicts.  This lowercases
   861    // and strips underscored from the fields before comparison in proto3 only.
   862    // The new behavior takes `json_name` into account and applies to proto2 as
   863    // well.
   864    // TODO Remove this legacy behavior once downstream teams have
   865    // had time to migrate.
   866    optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
   867  
   868    // Any features defined in the specific edition.
   869    optional FeatureSet features = 7;
   870  
   871    // The parser stores options it doesn't recognize here. See above.
   872    repeated UninterpretedOption uninterpreted_option = 999;
   873  
   874    extensions 1000 to max;
   875  }
   876  
   877  message EnumValueOptions {
   878    // Is this enum value deprecated?
   879    // Depending on the target platform, this can emit Deprecated annotations
   880    // for the enum value, or it will be completely ignored; in the very least,
   881    // this is a formalization for deprecating enum values.
   882    optional bool deprecated = 1 [default = false];
   883  
   884    // Any features defined in the specific edition.
   885    optional FeatureSet features = 2;
   886  
   887    // Indicate that fields annotated with this enum value should not be printed
   888    // out when using debug formats, e.g. when the field contains sensitive
   889    // credentials.
   890    optional bool debug_redact = 3 [default = false];
   891  
   892    // The parser stores options it doesn't recognize here. See above.
   893    repeated UninterpretedOption uninterpreted_option = 999;
   894  
   895    extensions 1000 to max;
   896  }
   897  
   898  message ServiceOptions {
   899    // Any features defined in the specific edition.
   900    optional FeatureSet features = 34;
   901  
   902    // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
   903    //   framework.  We apologize for hoarding these numbers to ourselves, but
   904    //   we were already using them long before we decided to release Protocol
   905    //   Buffers.
   906  
   907    // Is this service deprecated?
   908    // Depending on the target platform, this can emit Deprecated annotations
   909    // for the service, or it will be completely ignored; in the very least,
   910    // this is a formalization for deprecating services.
   911    optional bool deprecated = 33 [default = false];
   912  
   913    // The parser stores options it doesn't recognize here. See above.
   914    repeated UninterpretedOption uninterpreted_option = 999;
   915  
   916    extensions 1000 to max;
   917  }
   918  
   919  message MethodOptions {
   920    // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
   921    //   framework.  We apologize for hoarding these numbers to ourselves, but
   922    //   we were already using them long before we decided to release Protocol
   923    //   Buffers.
   924  
   925    // Is this method deprecated?
   926    // Depending on the target platform, this can emit Deprecated annotations
   927    // for the method, or it will be completely ignored; in the very least,
   928    // this is a formalization for deprecating methods.
   929    optional bool deprecated = 33 [default = false];
   930  
   931    // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
   932    // or neither? HTTP based RPC implementation may choose GET verb for safe
   933    // methods, and PUT verb for idempotent methods instead of the default POST.
   934    enum IdempotencyLevel {
   935      IDEMPOTENCY_UNKNOWN = 0;
   936  
   937      NO_SIDE_EFFECTS = 1;
   938  
   939      IDEMPOTENT = 2;
   940    }
   941  
   942    optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
   943  
   944    // Any features defined in the specific edition.
   945    optional FeatureSet features = 35;
   946  
   947    // The parser stores options it doesn't recognize here. See above.
   948    repeated UninterpretedOption uninterpreted_option = 999;
   949  
   950    extensions 1000 to max;
   951  }
   952  
   953  // A message representing a option the parser does not recognize. This only
   954  // appears in options protos created by the compiler::Parser class.
   955  // DescriptorPool resolves these when building Descriptor objects. Therefore,
   956  // options protos in descriptor objects (e.g. returned by Descriptor::options(),
   957  // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
   958  // in them.
   959  message UninterpretedOption {
   960    // The name of the uninterpreted option.  Each string represents a segment in
   961    // a dot-separated name.  is_extension is true iff a segment represents an
   962    // extension (denoted with parentheses in options specs in .proto files).
   963    // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
   964    // "foo.(bar.baz).moo".
   965    message NamePart {
   966      required string name_part = 1;
   967  
   968      required bool is_extension = 2;
   969    }
   970  
   971    repeated NamePart name = 2;
   972  
   973    // The value of the uninterpreted option, in whatever type the tokenizer
   974    // identified it as during parsing. Exactly one of these should be set.
   975    optional string identifier_value = 3;
   976  
   977    optional uint64 positive_int_value = 4;
   978  
   979    optional int64 negative_int_value = 5;
   980  
   981    optional double double_value = 6;
   982  
   983    optional bytes string_value = 7;
   984  
   985    optional string aggregate_value = 8;
   986  }
   987  
   988  // ===================================================================
   989  // Features
   990  
   991  // TODO Enums in C++ gencode (and potentially other languages) are
   992  // not well scoped.  This means that each of the feature enums below can clash
   993  // with each other.  The short names we've chosen maximize call-site
   994  // readability, but leave us very open to this scenario.  A future feature will
   995  // be designed and implemented to handle this, hopefully before we ever hit a
   996  // conflict here.
   997  message FeatureSet {
   998    enum FieldPresence {
   999      FIELD_PRESENCE_UNKNOWN = 0;
  1000  
  1001      EXPLICIT = 1;
  1002  
  1003      IMPLICIT = 2;
  1004  
  1005      LEGACY_REQUIRED = 3;
  1006    }
  1007  
  1008    optional FieldPresence field_presence = 1 [
  1009      retention = RETENTION_RUNTIME,
  1010      targets = TARGET_TYPE_FIELD,
  1011      targets = TARGET_TYPE_FILE,
  1012      edition_defaults = { value: "EXPLICIT", edition: EDITION_PROTO2 },
  1013      edition_defaults = { value: "IMPLICIT", edition: EDITION_PROTO3 },
  1014      edition_defaults = { value: "EXPLICIT", edition: EDITION_2023 }
  1015    ];
  1016  
  1017    enum EnumType {
  1018      ENUM_TYPE_UNKNOWN = 0;
  1019  
  1020      OPEN = 1;
  1021  
  1022      CLOSED = 2;
  1023    }
  1024  
  1025    optional EnumType enum_type = 2 [
  1026      retention = RETENTION_RUNTIME,
  1027      targets = TARGET_TYPE_ENUM,
  1028      targets = TARGET_TYPE_FILE,
  1029      edition_defaults = { value: "CLOSED", edition: EDITION_PROTO2 },
  1030      edition_defaults = { value: "OPEN", edition: EDITION_PROTO3 }
  1031    ];
  1032  
  1033    enum RepeatedFieldEncoding {
  1034      REPEATED_FIELD_ENCODING_UNKNOWN = 0;
  1035  
  1036      PACKED = 1;
  1037  
  1038      EXPANDED = 2;
  1039    }
  1040  
  1041    optional RepeatedFieldEncoding repeated_field_encoding = 3 [
  1042      retention = RETENTION_RUNTIME,
  1043      targets = TARGET_TYPE_FIELD,
  1044      targets = TARGET_TYPE_FILE,
  1045      edition_defaults = { value: "EXPANDED", edition: EDITION_PROTO2 },
  1046      edition_defaults = { value: "PACKED", edition: EDITION_PROTO3 }
  1047    ];
  1048  
  1049    enum Utf8Validation {
  1050      UTF8_VALIDATION_UNKNOWN = 0;
  1051  
  1052      VERIFY = 2;
  1053  
  1054      NONE = 3;
  1055    }
  1056  
  1057    optional Utf8Validation utf8_validation = 4 [
  1058      retention = RETENTION_RUNTIME,
  1059      targets = TARGET_TYPE_FIELD,
  1060      targets = TARGET_TYPE_FILE,
  1061      edition_defaults = { value: "NONE", edition: EDITION_PROTO2 },
  1062      edition_defaults = { value: "VERIFY", edition: EDITION_PROTO3 }
  1063    ];
  1064  
  1065    enum MessageEncoding {
  1066      MESSAGE_ENCODING_UNKNOWN = 0;
  1067  
  1068      LENGTH_PREFIXED = 1;
  1069  
  1070      DELIMITED = 2;
  1071    }
  1072  
  1073    optional MessageEncoding message_encoding = 5 [
  1074      retention = RETENTION_RUNTIME,
  1075      targets = TARGET_TYPE_FIELD,
  1076      targets = TARGET_TYPE_FILE,
  1077      edition_defaults = { value: "LENGTH_PREFIXED", edition: EDITION_PROTO2 }
  1078    ];
  1079  
  1080    enum JsonFormat {
  1081      JSON_FORMAT_UNKNOWN = 0;
  1082  
  1083      ALLOW = 1;
  1084  
  1085      LEGACY_BEST_EFFORT = 2;
  1086    }
  1087  
  1088    optional JsonFormat json_format = 6 [
  1089      retention = RETENTION_RUNTIME,
  1090      targets = TARGET_TYPE_MESSAGE,
  1091      targets = TARGET_TYPE_ENUM,
  1092      targets = TARGET_TYPE_FILE,
  1093      edition_defaults = { value: "LEGACY_BEST_EFFORT", edition: EDITION_PROTO2 },
  1094      edition_defaults = { value: "ALLOW", edition: EDITION_PROTO3 }
  1095    ];
  1096  
  1097    reserved 999;
  1098  
  1099    extensions 1000, 1001, 1002, 9995 to 9999, 10000;
  1100  }
  1101  
  1102  // A compiled specification for the defaults of a set of features.  These
  1103  // messages are generated from FeatureSet extensions and can be used to seed
  1104  // feature resolution. The resolution with this object becomes a simple search
  1105  // for the closest matching edition, followed by proto merges.
  1106  message FeatureSetDefaults {
  1107    // A map from every known edition with a unique set of defaults to its
  1108    // defaults. Not all editions may be contained here.  For a given edition,
  1109    // the defaults at the closest matching edition ordered at or before it should
  1110    // be used.  This field must be in strict ascending order by edition.
  1111    message FeatureSetEditionDefault {
  1112      optional Edition edition = 3;
  1113  
  1114      optional FeatureSet features = 2;
  1115    }
  1116  
  1117    repeated FeatureSetEditionDefault defaults = 1;
  1118  
  1119    // The minimum supported edition (inclusive) when this was constructed.
  1120    // Editions before this will not have defaults.
  1121    optional Edition minimum_edition = 4;
  1122  
  1123    // The maximum known edition (inclusive) when this was constructed. Editions
  1124    // after this will not have reliable defaults.
  1125    optional Edition maximum_edition = 5;
  1126  }
  1127  
  1128  // ===================================================================
  1129  // Optional source code info
  1130  
  1131  // Encapsulates information about the original source file from which a
  1132  // FileDescriptorProto was generated.
  1133  message SourceCodeInfo {
  1134    // A Location identifies a piece of source code in a .proto file which
  1135    // corresponds to a particular definition.  This information is intended
  1136    // to be useful to IDEs, code indexers, documentation generators, and similar
  1137    // tools.
  1138    //
  1139    // For example, say we have a file like:
  1140    //   message Foo {
  1141    //     optional string foo = 1;
  1142    //   }
  1143    // Let's look at just the field definition:
  1144    //   optional string foo = 1;
  1145    //   ^       ^^     ^^  ^  ^^^
  1146    //   a       bc     de  f  ghi
  1147    // We have the following locations:
  1148    //   span   path               represents
  1149    //   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
  1150    //   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
  1151    //   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
  1152    //   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
  1153    //   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
  1154    //
  1155    // Notes:
  1156    // - A location may refer to a repeated field itself (i.e. not to any
  1157    //   particular index within it).  This is used whenever a set of elements are
  1158    //   logically enclosed in a single code segment.  For example, an entire
  1159    //   extend block (possibly containing multiple extension definitions) will
  1160    //   have an outer location whose path refers to the "extensions" repeated
  1161    //   field without an index.
  1162    // - Multiple locations may have the same path.  This happens when a single
  1163    //   logical declaration is spread out across multiple places.  The most
  1164    //   obvious example is the "extend" block again -- there may be multiple
  1165    //   extend blocks in the same scope, each of which will have the same path.
  1166    // - A location's span is not always a subset of its parent's span.  For
  1167    //   example, the "extendee" of an extension declaration appears at the
  1168    //   beginning of the "extend" block and is shared by all extensions within
  1169    //   the block.
  1170    // - Just because a location's span is a subset of some other location's span
  1171    //   does not mean that it is a descendant.  For example, a "group" defines
  1172    //   both a type and a field in a single declaration.  Thus, the locations
  1173    //   corresponding to the type and field and their components will overlap.
  1174    // - Code which tries to interpret locations should probably be designed to
  1175    //   ignore those that it doesn't understand, as more types of locations could
  1176    //   be recorded in the future.
  1177    repeated Location location = 1;
  1178  
  1179    message Location {
  1180      // Identifies which part of the FileDescriptorProto was defined at this
  1181      // location.
  1182      //
  1183      // Each element is a field number or an index.  They form a path from
  1184      // the root FileDescriptorProto to the place where the definition appears.
  1185      // For example, this path:
  1186      //   [ 4, 3, 2, 7, 1 ]
  1187      // refers to:
  1188      //   file.message_type(3)  // 4, 3
  1189      //       .field(7)         // 2, 7
  1190      //       .name()           // 1
  1191      // This is because FileDescriptorProto.message_type has field number 4:
  1192      //   repeated DescriptorProto message_type = 4;
  1193      // and DescriptorProto.field has field number 2:
  1194      //   repeated FieldDescriptorProto field = 2;
  1195      // and FieldDescriptorProto.name has field number 1:
  1196      //   optional string name = 1;
  1197      //
  1198      // Thus, the above path gives the location of a field name.  If we removed
  1199      // the last element:
  1200      //   [ 4, 3, 2, 7 ]
  1201      // this path refers to the whole field declaration (from the beginning
  1202      // of the label to the terminating semicolon).
  1203      repeated int32 path = 1 [packed = true];
  1204  
  1205      // Always has exactly three or four elements: start line, start column,
  1206      // end line (optional, otherwise assumed same as start line), end column.
  1207      // These are packed into a single field for efficiency.  Note that line
  1208      // and column numbers are zero-based -- typically you will want to add
  1209      // 1 to each before displaying to a user.
  1210      repeated int32 span = 2 [packed = true];
  1211  
  1212      // If this SourceCodeInfo represents a complete declaration, these are any
  1213      // comments appearing before and after the declaration which appear to be
  1214      // attached to the declaration.
  1215      //
  1216      // A series of line comments appearing on consecutive lines, with no other
  1217      // tokens appearing on those lines, will be treated as a single comment.
  1218      //
  1219      // leading_detached_comments will keep paragraphs of comments that appear
  1220      // before (but not connected to) the current element. Each paragraph,
  1221      // separated by empty lines, will be one comment element in the repeated
  1222      // field.
  1223      //
  1224      // Only the comment content is provided; comment markers (e.g. //) are
  1225      // stripped out.  For block comments, leading whitespace and an asterisk
  1226      // will be stripped from the beginning of each line other than the first.
  1227      // Newlines are included in the output.
  1228      //
  1229      // Examples:
  1230      //
  1231      //   optional int32 foo = 1;  // Comment attached to foo.
  1232      //   // Comment attached to bar.
  1233      //   optional int32 bar = 2;
  1234      //
  1235      //   optional string baz = 3;
  1236      //   // Comment attached to baz.
  1237      //   // Another line attached to baz.
  1238      //
  1239      //   // Comment attached to moo.
  1240      //   //
  1241      //   // Another line attached to moo.
  1242      //   optional double moo = 4;
  1243      //
  1244      //   // Detached comment for corge. This is not leading or trailing comments
  1245      //   // to moo or corge because there are blank lines separating it from
  1246      //   // both.
  1247      //
  1248      //   // Detached comment for corge paragraph 2.
  1249      //
  1250      //   optional string corge = 5;
  1251      //   /* Block comment attached
  1252      //    * to corge.  Leading asterisks
  1253      //    * will be removed. */
  1254      //   /* Block comment attached to
  1255      //    * grault. */
  1256      //   optional int32 grault = 6;
  1257      //
  1258      //   // ignored detached comments.
  1259      optional string leading_comments = 3;
  1260  
  1261      optional string trailing_comments = 4;
  1262  
  1263      repeated string leading_detached_comments = 6;
  1264    }
  1265  }
  1266  
  1267  // Describes the relationship between generated code and its original source
  1268  // file. A GeneratedCodeInfo message is associated with only one generated
  1269  // source file, but may contain references to different source .proto files.
  1270  message GeneratedCodeInfo {
  1271    // An Annotation connects some span of text in generated code to an element
  1272    // of its generating .proto file.
  1273    repeated Annotation annotation = 1;
  1274  
  1275    message Annotation {
  1276      // Identifies the element in the original source .proto file. This field
  1277      // is formatted the same as SourceCodeInfo.Location.path.
  1278      repeated int32 path = 1 [packed = true];
  1279  
  1280      // Identifies the filesystem path to the original source .proto.
  1281      optional string source_file = 2;
  1282  
  1283      // Identifies the starting offset in bytes in the generated code
  1284      // that relates to the identified object.
  1285      optional int32 begin = 3;
  1286  
  1287      // Identifies the ending offset in bytes in the generated code that
  1288      // relates to the identified object. The end offset should be one past
  1289      // the last relevant byte (so the length of the text = end - begin).
  1290      optional int32 end = 4;
  1291  
  1292      // Represents the identified object's effect on the element in the original
  1293      // .proto file.
  1294      enum Semantic {
  1295        // There is no effect or the effect is indescribable.
  1296        NONE = 0;
  1297  
  1298        // The element is set or otherwise mutated.
  1299        SET = 1;
  1300  
  1301        // An alias to the element is returned.
  1302        ALIAS = 2;
  1303      }
  1304  
  1305      optional Semantic semantic = 5;
  1306    }
  1307  }