github.com/Big-big-orange/protoreflect@v0.0.0-20240408141420-285cedfdf6a4/desc/protoprint/testfiles/descriptor-trailing-on-next-line.proto (about)

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