Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/google/protobuf/descriptor.proto is written in an unsupported language. File is not indexed.

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2008 Google Inc.  All rights reserved.
0003 // https://developers.google.com/protocol-buffers/
0004 //
0005 // Redistribution and use in source and binary forms, with or without
0006 // modification, are permitted provided that the following conditions are
0007 // met:
0008 //
0009 //     * Redistributions of source code must retain the above copyright
0010 // notice, this list of conditions and the following disclaimer.
0011 //     * Redistributions in binary form must reproduce the above
0012 // copyright notice, this list of conditions and the following disclaimer
0013 // in the documentation and/or other materials provided with the
0014 // distribution.
0015 //     * Neither the name of Google Inc. nor the names of its
0016 // contributors may be used to endorse or promote products derived from
0017 // this software without specific prior written permission.
0018 //
0019 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0020 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0021 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0022 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0023 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0024 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0025 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0026 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0027 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0028 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0029 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0030 
0031 // Author: kenton@google.com (Kenton Varda)
0032 //  Based on original Protocol Buffers design by
0033 //  Sanjay Ghemawat, Jeff Dean, and others.
0034 //
0035 // The messages in this file describe the definitions found in .proto files.
0036 // A valid .proto file can be translated directly to a FileDescriptorProto
0037 // without any other information (e.g. without reading its imports).
0038 
0039 syntax = "proto2";
0040 
0041 package google.protobuf;
0042 
0043 option go_package = "google.golang.org/protobuf/types/descriptorpb";
0044 option java_package = "com.google.protobuf";
0045 option java_outer_classname = "DescriptorProtos";
0046 option csharp_namespace = "Google.Protobuf.Reflection";
0047 option objc_class_prefix = "GPB";
0048 option cc_enable_arenas = true;
0049 
0050 // descriptor.proto must be optimized for speed because reflection-based
0051 // algorithms don't work during bootstrapping.
0052 option optimize_for = SPEED;
0053 
0054 // The protocol compiler can output a FileDescriptorSet containing the .proto
0055 // files it parses.
0056 message FileDescriptorSet {
0057   repeated FileDescriptorProto file = 1;
0058 }
0059 
0060 // The full set of known editions.
0061 enum Edition {
0062   // A placeholder for an unknown edition value.
0063   EDITION_UNKNOWN = 0;
0064 
0065   // A placeholder edition for specifying default behaviors *before* a feature
0066   // was first introduced.  This is effectively an "infinite past".
0067   EDITION_LEGACY = 900;
0068 
0069   // Legacy syntax "editions".  These pre-date editions, but behave much like
0070   // distinct editions.  These can't be used to specify the edition of proto
0071   // files, but feature definitions must supply proto2/proto3 defaults for
0072   // backwards compatibility.
0073   EDITION_PROTO2 = 998;
0074   EDITION_PROTO3 = 999;
0075 
0076   // Editions that have been released.  The specific values are arbitrary and
0077   // should not be depended on, but they will always be time-ordered for easy
0078   // comparison.
0079   EDITION_2023 = 1000;
0080   EDITION_2024 = 1001;
0081 
0082   // Placeholder editions for testing feature resolution.  These should not be
0083   // used or relyed on outside of tests.
0084   EDITION_1_TEST_ONLY = 1;
0085   EDITION_2_TEST_ONLY = 2;
0086   EDITION_99997_TEST_ONLY = 99997;
0087   EDITION_99998_TEST_ONLY = 99998;
0088   EDITION_99999_TEST_ONLY = 99999;
0089 
0090   // Placeholder for specifying unbounded edition support.  This should only
0091   // ever be used by plugins that can expect to never require any changes to
0092   // support a new edition.
0093   EDITION_MAX = 0x7FFFFFFF;
0094 }
0095 
0096 // Describes a complete .proto file.
0097 message FileDescriptorProto {
0098   optional string name = 1;     // file name, relative to root of source tree
0099   optional string package = 2;  // e.g. "foo", "foo.bar", etc.
0100 
0101   // Names of files imported by this file.
0102   repeated string dependency = 3;
0103   // Indexes of the public imported files in the dependency list above.
0104   repeated int32 public_dependency = 10;
0105   // Indexes of the weak imported files in the dependency list.
0106   // For Google-internal migration only. Do not use.
0107   repeated int32 weak_dependency = 11;
0108 
0109   // All top-level definitions in this file.
0110   repeated DescriptorProto message_type = 4;
0111   repeated EnumDescriptorProto enum_type = 5;
0112   repeated ServiceDescriptorProto service = 6;
0113   repeated FieldDescriptorProto extension = 7;
0114 
0115   optional FileOptions options = 8;
0116 
0117   // This field contains optional information about the original source code.
0118   // You may safely remove this entire field without harming runtime
0119   // functionality of the descriptors -- the information is needed only by
0120   // development tools.
0121   optional SourceCodeInfo source_code_info = 9;
0122 
0123   // The syntax of the proto file.
0124   // The supported values are "proto2", "proto3", and "editions".
0125   //
0126   // If `edition` is present, this value must be "editions".
0127   optional string syntax = 12;
0128 
0129   // The edition of the proto file.
0130   optional Edition edition = 14;
0131 }
0132 
0133 // Describes a message type.
0134 message DescriptorProto {
0135   optional string name = 1;
0136 
0137   repeated FieldDescriptorProto field = 2;
0138   repeated FieldDescriptorProto extension = 6;
0139 
0140   repeated DescriptorProto nested_type = 3;
0141   repeated EnumDescriptorProto enum_type = 4;
0142 
0143   message ExtensionRange {
0144     optional int32 start = 1;  // Inclusive.
0145     optional int32 end = 2;    // Exclusive.
0146 
0147     optional ExtensionRangeOptions options = 3;
0148   }
0149   repeated ExtensionRange extension_range = 5;
0150 
0151   repeated OneofDescriptorProto oneof_decl = 8;
0152 
0153   optional MessageOptions options = 7;
0154 
0155   // Range of reserved tag numbers. Reserved tag numbers may not be used by
0156   // fields or extension ranges in the same message. Reserved ranges may
0157   // not overlap.
0158   message ReservedRange {
0159     optional int32 start = 1;  // Inclusive.
0160     optional int32 end = 2;    // Exclusive.
0161   }
0162   repeated ReservedRange reserved_range = 9;
0163   // Reserved field names, which may not be used by fields in the same message.
0164   // A given name may only be reserved once.
0165   repeated string reserved_name = 10;
0166 }
0167 
0168 message ExtensionRangeOptions {
0169   // The parser stores options it doesn't recognize here. See above.
0170   repeated UninterpretedOption uninterpreted_option = 999;
0171 
0172   message Declaration {
0173     // The extension number declared within the extension range.
0174     optional int32 number = 1;
0175 
0176     // The fully-qualified name of the extension field. There must be a leading
0177     // dot in front of the full name.
0178     optional string full_name = 2;
0179 
0180     // The fully-qualified type name of the extension field. Unlike
0181     // Metadata.type, Declaration.type must have a leading dot for messages
0182     // and enums.
0183     optional string type = 3;
0184 
0185     // If true, indicates that the number is reserved in the extension range,
0186     // and any extension field with the number will fail to compile. Set this
0187     // when a declared extension field is deleted.
0188     optional bool reserved = 5;
0189 
0190     // If true, indicates that the extension must be defined as repeated.
0191     // Otherwise the extension must be defined as optional.
0192     optional bool repeated = 6;
0193 
0194     reserved 4;  // removed is_repeated
0195   }
0196 
0197   // For external users: DO NOT USE. We are in the process of open sourcing
0198   // extension declaration and executing internal cleanups before it can be
0199   // used externally.
0200   repeated Declaration declaration = 2 [retention = RETENTION_SOURCE];
0201 
0202   // Any features defined in the specific edition.
0203   optional FeatureSet features = 50;
0204 
0205   // The verification state of the extension range.
0206   enum VerificationState {
0207     // All the extensions of the range must be declared.
0208     DECLARATION = 0;
0209     UNVERIFIED = 1;
0210   }
0211 
0212   // The verification state of the range.
0213   // TODO: flip the default to DECLARATION once all empty ranges
0214   // are marked as UNVERIFIED.
0215   optional VerificationState verification = 3
0216       [default = UNVERIFIED, retention = RETENTION_SOURCE];
0217 
0218   // Clients can define custom options in extensions of this message. See above.
0219   extensions 1000 to max;
0220 }
0221 
0222 // Describes a field within a message.
0223 message FieldDescriptorProto {
0224   enum Type {
0225     // 0 is reserved for errors.
0226     // Order is weird for historical reasons.
0227     TYPE_DOUBLE = 1;
0228     TYPE_FLOAT = 2;
0229     // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
0230     // negative values are likely.
0231     TYPE_INT64 = 3;
0232     TYPE_UINT64 = 4;
0233     // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
0234     // negative values are likely.
0235     TYPE_INT32 = 5;
0236     TYPE_FIXED64 = 6;
0237     TYPE_FIXED32 = 7;
0238     TYPE_BOOL = 8;
0239     TYPE_STRING = 9;
0240     // Tag-delimited aggregate.
0241     // Group type is deprecated and not supported after google.protobuf. However, Proto3
0242     // implementations should still be able to parse the group wire format and
0243     // treat group fields as unknown fields.  In Editions, the group wire format
0244     // can be enabled via the `message_encoding` feature.
0245     TYPE_GROUP = 10;
0246     TYPE_MESSAGE = 11;  // Length-delimited aggregate.
0247 
0248     // New in version 2.
0249     TYPE_BYTES = 12;
0250     TYPE_UINT32 = 13;
0251     TYPE_ENUM = 14;
0252     TYPE_SFIXED32 = 15;
0253     TYPE_SFIXED64 = 16;
0254     TYPE_SINT32 = 17;  // Uses ZigZag encoding.
0255     TYPE_SINT64 = 18;  // Uses ZigZag encoding.
0256   }
0257 
0258   enum Label {
0259     // 0 is reserved for errors
0260     LABEL_OPTIONAL = 1;
0261     LABEL_REPEATED = 3;
0262     // The required label is only allowed in google.protobuf.  In proto3 and Editions
0263     // it's explicitly prohibited.  In Editions, the `field_presence` feature
0264     // can be used to get this behavior.
0265     LABEL_REQUIRED = 2;
0266   }
0267 
0268   optional string name = 1;
0269   optional int32 number = 3;
0270   optional Label label = 4;
0271 
0272   // If type_name is set, this need not be set.  If both this and type_name
0273   // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
0274   optional Type type = 5;
0275 
0276   // For message and enum types, this is the name of the type.  If the name
0277   // starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
0278   // rules are used to find the type (i.e. first the nested types within this
0279   // message are searched, then within the parent, on up to the root
0280   // namespace).
0281   optional string type_name = 6;
0282 
0283   // For extensions, this is the name of the type being extended.  It is
0284   // resolved in the same manner as type_name.
0285   optional string extendee = 2;
0286 
0287   // For numeric types, contains the original text representation of the value.
0288   // For booleans, "true" or "false".
0289   // For strings, contains the default text contents (not escaped in any way).
0290   // For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
0291   optional string default_value = 7;
0292 
0293   // If set, gives the index of a oneof in the containing type's oneof_decl
0294   // list.  This field is a member of that oneof.
0295   optional int32 oneof_index = 9;
0296 
0297   // JSON name of this field. The value is set by protocol compiler. If the
0298   // user has set a "json_name" option on this field, that option's value
0299   // will be used. Otherwise, it's deduced from the field's name by converting
0300   // it to camelCase.
0301   optional string json_name = 10;
0302 
0303   optional FieldOptions options = 8;
0304 
0305   // If true, this is a proto3 "optional". When a proto3 field is optional, it
0306   // tracks presence regardless of field type.
0307   //
0308   // When proto3_optional is true, this field must belong to a oneof to signal
0309   // to old proto3 clients that presence is tracked for this field. This oneof
0310   // is known as a "synthetic" oneof, and this field must be its sole member
0311   // (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
0312   // exist in the descriptor only, and do not generate any API. Synthetic oneofs
0313   // must be ordered after all "real" oneofs.
0314   //
0315   // For message fields, proto3_optional doesn't create any semantic change,
0316   // since non-repeated message fields always track presence. However it still
0317   // indicates the semantic detail of whether the user wrote "optional" or not.
0318   // This can be useful for round-tripping the .proto file. For consistency we
0319   // give message fields a synthetic oneof also, even though it is not required
0320   // to track presence. This is especially important because the parser can't
0321   // tell if a field is a message or an enum, so it must always create a
0322   // synthetic oneof.
0323   //
0324   // Proto2 optional fields do not set this flag, because they already indicate
0325   // optional with `LABEL_OPTIONAL`.
0326   optional bool proto3_optional = 17;
0327 }
0328 
0329 // Describes a oneof.
0330 message OneofDescriptorProto {
0331   optional string name = 1;
0332   optional OneofOptions options = 2;
0333 }
0334 
0335 // Describes an enum type.
0336 message EnumDescriptorProto {
0337   optional string name = 1;
0338 
0339   repeated EnumValueDescriptorProto value = 2;
0340 
0341   optional EnumOptions options = 3;
0342 
0343   // Range of reserved numeric values. Reserved values may not be used by
0344   // entries in the same enum. Reserved ranges may not overlap.
0345   //
0346   // Note that this is distinct from DescriptorProto.ReservedRange in that it
0347   // is inclusive such that it can appropriately represent the entire int32
0348   // domain.
0349   message EnumReservedRange {
0350     optional int32 start = 1;  // Inclusive.
0351     optional int32 end = 2;    // Inclusive.
0352   }
0353 
0354   // Range of reserved numeric values. Reserved numeric values may not be used
0355   // by enum values in the same enum declaration. Reserved ranges may not
0356   // overlap.
0357   repeated EnumReservedRange reserved_range = 4;
0358 
0359   // Reserved enum value names, which may not be reused. A given name may only
0360   // be reserved once.
0361   repeated string reserved_name = 5;
0362 }
0363 
0364 // Describes a value within an enum.
0365 message EnumValueDescriptorProto {
0366   optional string name = 1;
0367   optional int32 number = 2;
0368 
0369   optional EnumValueOptions options = 3;
0370 }
0371 
0372 // Describes a service.
0373 message ServiceDescriptorProto {
0374   optional string name = 1;
0375   repeated MethodDescriptorProto method = 2;
0376 
0377   optional ServiceOptions options = 3;
0378 }
0379 
0380 // Describes a method of a service.
0381 message MethodDescriptorProto {
0382   optional string name = 1;
0383 
0384   // Input and output type names.  These are resolved in the same way as
0385   // FieldDescriptorProto.type_name, but must refer to a message type.
0386   optional string input_type = 2;
0387   optional string output_type = 3;
0388 
0389   optional MethodOptions options = 4;
0390 
0391   // Identifies if client streams multiple client messages
0392   optional bool client_streaming = 5 [default = false];
0393   // Identifies if server streams multiple server messages
0394   optional bool server_streaming = 6 [default = false];
0395 }
0396 
0397 // ===================================================================
0398 // Options
0399 
0400 // Each of the definitions above may have "options" attached.  These are
0401 // just annotations which may cause code to be generated slightly differently
0402 // or may contain hints for code that manipulates protocol messages.
0403 //
0404 // Clients may define custom options as extensions of the *Options messages.
0405 // These extensions may not yet be known at parsing time, so the parser cannot
0406 // store the values in them.  Instead it stores them in a field in the *Options
0407 // message called uninterpreted_option. This field must have the same name
0408 // across all *Options messages. We then use this field to populate the
0409 // extensions when we build a descriptor, at which point all protos have been
0410 // parsed and so all extensions are known.
0411 //
0412 // Extension numbers for custom options may be chosen as follows:
0413 // * For options which will only be used within a single application or
0414 //   organization, or for experimental options, use field numbers 50000
0415 //   through 99999.  It is up to you to ensure that you do not use the
0416 //   same number for multiple options.
0417 // * For options which will be published and used publicly by multiple
0418 //   independent entities, e-mail protobuf-global-extension-registry@google.com
0419 //   to reserve extension numbers. Simply provide your project name (e.g.
0420 //   Objective-C plugin) and your project website (if available) -- there's no
0421 //   need to explain how you intend to use them. Usually you only need one
0422 //   extension number. You can declare multiple options with only one extension
0423 //   number by putting them in a sub-message. See the Custom Options section of
0424 //   the docs for examples:
0425 //   https://developers.google.com/protocol-buffers/docs/proto#options
0426 //   If this turns out to be popular, a web service will be set up
0427 //   to automatically assign option numbers.
0428 
0429 message FileOptions {
0430 
0431   // Sets the Java package where classes generated from this .proto will be
0432   // placed.  By default, the proto package is used, but this is often
0433   // inappropriate because proto packages do not normally start with backwards
0434   // domain names.
0435   optional string java_package = 1;
0436 
0437   // Controls the name of the wrapper Java class generated for the .proto file.
0438   // That class will always contain the .proto file's getDescriptor() method as
0439   // well as any top-level extensions defined in the .proto file.
0440   // If java_multiple_files is disabled, then all the other classes from the
0441   // .proto file will be nested inside the single wrapper outer class.
0442   optional string java_outer_classname = 8;
0443 
0444   // If enabled, then the Java code generator will generate a separate .java
0445   // file for each top-level message, enum, and service defined in the .proto
0446   // file.  Thus, these types will *not* be nested inside the wrapper class
0447   // named by java_outer_classname.  However, the wrapper class will still be
0448   // generated to contain the file's getDescriptor() method as well as any
0449   // top-level extensions defined in the file.
0450   optional bool java_multiple_files = 10 [default = false];
0451 
0452   // This option does nothing.
0453   optional bool java_generate_equals_and_hash = 20 [deprecated=true];
0454 
0455   // A proto2 file can set this to true to opt in to UTF-8 checking for Java,
0456   // which will throw an exception if invalid UTF-8 is parsed from the wire or
0457   // assigned to a string field.
0458   //
0459   // TODO: clarify exactly what kinds of field types this option
0460   // applies to, and update these docs accordingly.
0461   //
0462   // Proto3 files already perform these checks. Setting the option explicitly to
0463   // false has no effect: it cannot be used to opt proto3 files out of UTF-8
0464   // checks.
0465   optional bool java_string_check_utf8 = 27 [default = false];
0466 
0467   // Generated classes can be optimized for speed or code size.
0468   enum OptimizeMode {
0469     SPEED = 1;         // Generate complete code for parsing, serialization,
0470                        // etc.
0471     CODE_SIZE = 2;     // Use ReflectionOps to implement these methods.
0472     LITE_RUNTIME = 3;  // Generate code using MessageLite and the lite runtime.
0473   }
0474   optional OptimizeMode optimize_for = 9 [default = SPEED];
0475 
0476   // Sets the Go package where structs generated from this .proto will be
0477   // placed. If omitted, the Go package will be derived from the following:
0478   //   - The basename of the package import path, if provided.
0479   //   - Otherwise, the package statement in the .proto file, if present.
0480   //   - Otherwise, the basename of the .proto file, without extension.
0481   optional string go_package = 11;
0482 
0483   // Should generic services be generated in each language?  "Generic" services
0484   // are not specific to any particular RPC system.  They are generated by the
0485   // main code generators in each language (without additional plugins).
0486   // Generic services were the only kind of service generation supported by
0487   // early versions of google.protobuf.
0488   //
0489   // Generic services are now considered deprecated in favor of using plugins
0490   // that generate code specific to your particular RPC system.  Therefore,
0491   // these default to false.  Old code which depends on generic services should
0492   // explicitly set them to true.
0493   optional bool cc_generic_services = 16 [default = false];
0494   optional bool java_generic_services = 17 [default = false];
0495   optional bool py_generic_services = 18 [default = false];
0496   reserved 42;  // removed php_generic_services
0497   reserved "php_generic_services";
0498 
0499   // Is this file deprecated?
0500   // Depending on the target platform, this can emit Deprecated annotations
0501   // for everything in the file, or it will be completely ignored; in the very
0502   // least, this is a formalization for deprecating files.
0503   optional bool deprecated = 23 [default = false];
0504 
0505   // Enables the use of arenas for the proto messages in this file. This applies
0506   // only to generated classes for C++.
0507   optional bool cc_enable_arenas = 31 [default = true];
0508 
0509   // Sets the objective c class prefix which is prepended to all objective c
0510   // generated classes from this .proto. There is no default.
0511   optional string objc_class_prefix = 36;
0512 
0513   // Namespace for generated classes; defaults to the package.
0514   optional string csharp_namespace = 37;
0515 
0516   // By default Swift generators will take the proto package and CamelCase it
0517   // replacing '.' with underscore and use that to prefix the types/symbols
0518   // defined. When this options is provided, they will use this value instead
0519   // to prefix the types/symbols defined.
0520   optional string swift_prefix = 39;
0521 
0522   // Sets the php class prefix which is prepended to all php generated classes
0523   // from this .proto. Default is empty.
0524   optional string php_class_prefix = 40;
0525 
0526   // Use this option to change the namespace of php generated classes. Default
0527   // is empty. When this option is empty, the package name will be used for
0528   // determining the namespace.
0529   optional string php_namespace = 41;
0530 
0531   // Use this option to change the namespace of php generated metadata classes.
0532   // Default is empty. When this option is empty, the proto file name will be
0533   // used for determining the namespace.
0534   optional string php_metadata_namespace = 44;
0535 
0536   // Use this option to change the package of ruby generated classes. Default
0537   // is empty. When this option is not set, the package name will be used for
0538   // determining the ruby package.
0539   optional string ruby_package = 45;
0540 
0541   // Any features defined in the specific edition.
0542   optional FeatureSet features = 50;
0543 
0544   // The parser stores options it doesn't recognize here.
0545   // See the documentation for the "Options" section above.
0546   repeated UninterpretedOption uninterpreted_option = 999;
0547 
0548   // Clients can define custom options in extensions of this message.
0549   // See the documentation for the "Options" section above.
0550   extensions 1000 to max;
0551 
0552   reserved 38;
0553 }
0554 
0555 message MessageOptions {
0556   // Set true to use the old proto1 MessageSet wire format for extensions.
0557   // This is provided for backwards-compatibility with the MessageSet wire
0558   // format.  You should not use this for any other reason:  It's less
0559   // efficient, has fewer features, and is more complicated.
0560   //
0561   // The message must be defined exactly as follows:
0562   //   message Foo {
0563   //     option message_set_wire_format = true;
0564   //     extensions 4 to max;
0565   //   }
0566   // Note that the message cannot have any defined fields; MessageSets only
0567   // have extensions.
0568   //
0569   // All extensions of your type must be singular messages; e.g. they cannot
0570   // be int32s, enums, or repeated messages.
0571   //
0572   // Because this is an option, the above two restrictions are not enforced by
0573   // the protocol compiler.
0574   optional bool message_set_wire_format = 1 [default = false];
0575 
0576   // Disables the generation of the standard "descriptor()" accessor, which can
0577   // conflict with a field of the same name.  This is meant to make migration
0578   // from proto1 easier; new code should avoid fields named "descriptor".
0579   optional bool no_standard_descriptor_accessor = 2 [default = false];
0580 
0581   // Is this message deprecated?
0582   // Depending on the target platform, this can emit Deprecated annotations
0583   // for the message, or it will be completely ignored; in the very least,
0584   // this is a formalization for deprecating messages.
0585   optional bool deprecated = 3 [default = false];
0586 
0587   reserved 4, 5, 6;
0588 
0589   // Whether the message is an automatically generated map entry type for the
0590   // maps field.
0591   //
0592   // For maps fields:
0593   //     map<KeyType, ValueType> map_field = 1;
0594   // The parsed descriptor looks like:
0595   //     message MapFieldEntry {
0596   //         option map_entry = true;
0597   //         optional KeyType key = 1;
0598   //         optional ValueType value = 2;
0599   //     }
0600   //     repeated MapFieldEntry map_field = 1;
0601   //
0602   // Implementations may choose not to generate the map_entry=true message, but
0603   // use a native map in the target language to hold the keys and values.
0604   // The reflection APIs in such implementations still need to work as
0605   // if the field is a repeated message field.
0606   //
0607   // NOTE: Do not set the option in .proto files. Always use the maps syntax
0608   // instead. The option should only be implicitly set by the proto compiler
0609   // parser.
0610   optional bool map_entry = 7;
0611 
0612   reserved 8;  // javalite_serializable
0613   reserved 9;  // javanano_as_lite
0614 
0615   // Enable the legacy handling of JSON field name conflicts.  This lowercases
0616   // and strips underscored from the fields before comparison in proto3 only.
0617   // The new behavior takes `json_name` into account and applies to proto2 as
0618   // well.
0619   //
0620   // This should only be used as a temporary measure against broken builds due
0621   // to the change in behavior for JSON field name conflicts.
0622   //
0623   // TODO This is legacy behavior we plan to remove once downstream
0624   // teams have had time to migrate.
0625   optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
0626 
0627   // Any features defined in the specific edition.
0628   optional FeatureSet features = 12;
0629 
0630   // The parser stores options it doesn't recognize here. See above.
0631   repeated UninterpretedOption uninterpreted_option = 999;
0632 
0633   // Clients can define custom options in extensions of this message. See above.
0634   extensions 1000 to max;
0635 }
0636 
0637 message FieldOptions {
0638   // NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
0639   // The ctype option instructs the C++ code generator to use a different
0640   // representation of the field than it normally would.  See the specific
0641   // options below.  This option is only implemented to support use of
0642   // [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
0643   // type "bytes" in the open source release.
0644   // TODO: make ctype actually deprecated.
0645   optional CType ctype = 1 [/*deprecated = true,*/ default = STRING];
0646   enum CType {
0647     // Default mode.
0648     STRING = 0;
0649 
0650     // The option [ctype=CORD] may be applied to a non-repeated field of type
0651     // "bytes". It indicates that in C++, the data should be stored in a Cord
0652     // instead of a string.  For very large strings, this may reduce memory
0653     // fragmentation. It may also allow better performance when parsing from a
0654     // Cord, or when parsing with aliasing enabled, as the parsed Cord may then
0655     // alias the original buffer.
0656     CORD = 1;
0657 
0658     STRING_PIECE = 2;
0659   }
0660   // The packed option can be enabled for repeated primitive fields to enable
0661   // a more efficient representation on the wire. Rather than repeatedly
0662   // writing the tag and type for each element, the entire array is encoded as
0663   // a single length-delimited blob. In proto3, only explicit setting it to
0664   // false will avoid using packed encoding.  This option is prohibited in
0665   // Editions, but the `repeated_field_encoding` feature can be used to control
0666   // the behavior.
0667   optional bool packed = 2;
0668 
0669   // The jstype option determines the JavaScript type used for values of the
0670   // field.  The option is permitted only for 64 bit integral and fixed types
0671   // (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING
0672   // is represented as JavaScript string, which avoids loss of precision that
0673   // can happen when a large value is converted to a floating point JavaScript.
0674   // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
0675   // use the JavaScript "number" type.  The behavior of the default option
0676   // JS_NORMAL is implementation dependent.
0677   //
0678   // This option is an enum to permit additional types to be added, e.g.
0679   // goog.math.Integer.
0680   optional JSType jstype = 6 [default = JS_NORMAL];
0681   enum JSType {
0682     // Use the default type.
0683     JS_NORMAL = 0;
0684 
0685     // Use JavaScript strings.
0686     JS_STRING = 1;
0687 
0688     // Use JavaScript numbers.
0689     JS_NUMBER = 2;
0690   }
0691 
0692   // Should this field be parsed lazily?  Lazy applies only to message-type
0693   // fields.  It means that when the outer message is initially parsed, the
0694   // inner message's contents will not be parsed but instead stored in encoded
0695   // form.  The inner message will actually be parsed when it is first accessed.
0696   //
0697   // This is only a hint.  Implementations are free to choose whether to use
0698   // eager or lazy parsing regardless of the value of this option.  However,
0699   // setting this option true suggests that the protocol author believes that
0700   // using lazy parsing on this field is worth the additional bookkeeping
0701   // overhead typically needed to implement it.
0702   //
0703   // This option does not affect the public interface of any generated code;
0704   // all method signatures remain the same.  Furthermore, thread-safety of the
0705   // interface is not affected by this option; const methods remain safe to
0706   // call from multiple threads concurrently, while non-const methods continue
0707   // to require exclusive access.
0708   //
0709   // Note that lazy message fields are still eagerly verified to check
0710   // ill-formed wireformat or missing required fields. Calling IsInitialized()
0711   // on the outer message would fail if the inner message has missing required
0712   // fields. Failed verification would result in parsing failure (except when
0713   // uninitialized messages are acceptable).
0714   optional bool lazy = 5 [default = false];
0715 
0716   // unverified_lazy does no correctness checks on the byte stream. This should
0717   // only be used where lazy with verification is prohibitive for performance
0718   // reasons.
0719   optional bool unverified_lazy = 15 [default = false];
0720 
0721   // Is this field deprecated?
0722   // Depending on the target platform, this can emit Deprecated annotations
0723   // for accessors, or it will be completely ignored; in the very least, this
0724   // is a formalization for deprecating fields.
0725   optional bool deprecated = 3 [default = false];
0726 
0727   // For Google-internal migration only. Do not use.
0728   optional bool weak = 10 [default = false];
0729 
0730   // Indicate that the field value should not be printed out when using debug
0731   // formats, e.g. when the field contains sensitive credentials.
0732   optional bool debug_redact = 16 [default = false];
0733 
0734   // If set to RETENTION_SOURCE, the option will be omitted from the binary.
0735   // Note: as of January 2023, support for this is in progress and does not yet
0736   // have an effect (b/264593489).
0737   enum OptionRetention {
0738     RETENTION_UNKNOWN = 0;
0739     RETENTION_RUNTIME = 1;
0740     RETENTION_SOURCE = 2;
0741   }
0742 
0743   optional OptionRetention retention = 17;
0744 
0745   // This indicates the types of entities that the field may apply to when used
0746   // as an option. If it is unset, then the field may be freely used as an
0747   // option on any kind of entity. Note: as of January 2023, support for this is
0748   // in progress and does not yet have an effect (b/264593489).
0749   enum OptionTargetType {
0750     TARGET_TYPE_UNKNOWN = 0;
0751     TARGET_TYPE_FILE = 1;
0752     TARGET_TYPE_EXTENSION_RANGE = 2;
0753     TARGET_TYPE_MESSAGE = 3;
0754     TARGET_TYPE_FIELD = 4;
0755     TARGET_TYPE_ONEOF = 5;
0756     TARGET_TYPE_ENUM = 6;
0757     TARGET_TYPE_ENUM_ENTRY = 7;
0758     TARGET_TYPE_SERVICE = 8;
0759     TARGET_TYPE_METHOD = 9;
0760   }
0761 
0762   repeated OptionTargetType targets = 19;
0763 
0764   message EditionDefault {
0765     optional Edition edition = 3;
0766     optional string value = 2;  // Textproto value.
0767   }
0768   repeated EditionDefault edition_defaults = 20;
0769 
0770   // Any features defined in the specific edition.
0771   optional FeatureSet features = 21;
0772 
0773   // Information about the support window of a feature.
0774   message FeatureSupport {
0775     // The edition that this feature was first available in.  In editions
0776     // earlier than this one, the default assigned to EDITION_LEGACY will be
0777     // used, and proto files will not be able to override it.
0778     optional Edition edition_introduced = 1;
0779 
0780     // The edition this feature becomes deprecated in.  Using this after this
0781     // edition may trigger warnings.
0782     optional Edition edition_deprecated = 2;
0783 
0784     // The deprecation warning text if this feature is used after the edition it
0785     // was marked deprecated in.
0786     optional string deprecation_warning = 3;
0787 
0788     // The edition this feature is no longer available in.  In editions after
0789     // this one, the last default assigned will be used, and proto files will
0790     // not be able to override it.
0791     optional Edition edition_removed = 4;
0792   }
0793   optional FeatureSupport feature_support = 22;
0794 
0795   // The parser stores options it doesn't recognize here. See above.
0796   repeated UninterpretedOption uninterpreted_option = 999;
0797 
0798   // Clients can define custom options in extensions of this message. See above.
0799   extensions 1000 to max;
0800 
0801   reserved 4;   // removed jtype
0802   reserved 18;  // reserve target, target_obsolete_do_not_use
0803 }
0804 
0805 message OneofOptions {
0806   // Any features defined in the specific edition.
0807   optional FeatureSet features = 1;
0808 
0809   // The parser stores options it doesn't recognize here. See above.
0810   repeated UninterpretedOption uninterpreted_option = 999;
0811 
0812   // Clients can define custom options in extensions of this message. See above.
0813   extensions 1000 to max;
0814 }
0815 
0816 message EnumOptions {
0817 
0818   // Set this option to true to allow mapping different tag names to the same
0819   // value.
0820   optional bool allow_alias = 2;
0821 
0822   // Is this enum deprecated?
0823   // Depending on the target platform, this can emit Deprecated annotations
0824   // for the enum, or it will be completely ignored; in the very least, this
0825   // is a formalization for deprecating enums.
0826   optional bool deprecated = 3 [default = false];
0827 
0828   reserved 5;  // javanano_as_lite
0829 
0830   // Enable the legacy handling of JSON field name conflicts.  This lowercases
0831   // and strips underscored from the fields before comparison in proto3 only.
0832   // The new behavior takes `json_name` into account and applies to proto2 as
0833   // well.
0834   // TODO Remove this legacy behavior once downstream teams have
0835   // had time to migrate.
0836   optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
0837 
0838   // Any features defined in the specific edition.
0839   optional FeatureSet features = 7;
0840 
0841   // The parser stores options it doesn't recognize here. See above.
0842   repeated UninterpretedOption uninterpreted_option = 999;
0843 
0844   // Clients can define custom options in extensions of this message. See above.
0845   extensions 1000 to max;
0846 }
0847 
0848 message EnumValueOptions {
0849   // Is this enum value deprecated?
0850   // Depending on the target platform, this can emit Deprecated annotations
0851   // for the enum value, or it will be completely ignored; in the very least,
0852   // this is a formalization for deprecating enum values.
0853   optional bool deprecated = 1 [default = false];
0854 
0855   // Any features defined in the specific edition.
0856   optional FeatureSet features = 2;
0857 
0858   // Indicate that fields annotated with this enum value should not be printed
0859   // out when using debug formats, e.g. when the field contains sensitive
0860   // credentials.
0861   optional bool debug_redact = 3 [default = false];
0862 
0863   // Information about the support window of a feature value.
0864   optional FieldOptions.FeatureSupport feature_support = 4;
0865 
0866   // The parser stores options it doesn't recognize here. See above.
0867   repeated UninterpretedOption uninterpreted_option = 999;
0868 
0869   // Clients can define custom options in extensions of this message. See above.
0870   extensions 1000 to max;
0871 }
0872 
0873 message ServiceOptions {
0874 
0875   // Any features defined in the specific edition.
0876   optional FeatureSet features = 34;
0877 
0878   // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
0879   //   framework.  We apologize for hoarding these numbers to ourselves, but
0880   //   we were already using them long before we decided to release Protocol
0881   //   Buffers.
0882 
0883   // Is this service deprecated?
0884   // Depending on the target platform, this can emit Deprecated annotations
0885   // for the service, or it will be completely ignored; in the very least,
0886   // this is a formalization for deprecating services.
0887   optional bool deprecated = 33 [default = false];
0888 
0889   // The parser stores options it doesn't recognize here. See above.
0890   repeated UninterpretedOption uninterpreted_option = 999;
0891 
0892   // Clients can define custom options in extensions of this message. See above.
0893   extensions 1000 to max;
0894 }
0895 
0896 message MethodOptions {
0897 
0898   // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
0899   //   framework.  We apologize for hoarding these numbers to ourselves, but
0900   //   we were already using them long before we decided to release Protocol
0901   //   Buffers.
0902 
0903   // Is this method deprecated?
0904   // Depending on the target platform, this can emit Deprecated annotations
0905   // for the method, or it will be completely ignored; in the very least,
0906   // this is a formalization for deprecating methods.
0907   optional bool deprecated = 33 [default = false];
0908 
0909   // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
0910   // or neither? HTTP based RPC implementation may choose GET verb for safe
0911   // methods, and PUT verb for idempotent methods instead of the default POST.
0912   enum IdempotencyLevel {
0913     IDEMPOTENCY_UNKNOWN = 0;
0914     NO_SIDE_EFFECTS = 1;  // implies idempotent
0915     IDEMPOTENT = 2;       // idempotent, but may have side effects
0916   }
0917   optional IdempotencyLevel idempotency_level = 34
0918       [default = IDEMPOTENCY_UNKNOWN];
0919 
0920   // Any features defined in the specific edition.
0921   optional FeatureSet features = 35;
0922 
0923   // The parser stores options it doesn't recognize here. See above.
0924   repeated UninterpretedOption uninterpreted_option = 999;
0925 
0926   // Clients can define custom options in extensions of this message. See above.
0927   extensions 1000 to max;
0928 }
0929 
0930 // A message representing a option the parser does not recognize. This only
0931 // appears in options protos created by the compiler::Parser class.
0932 // DescriptorPool resolves these when building Descriptor objects. Therefore,
0933 // options protos in descriptor objects (e.g. returned by Descriptor::options(),
0934 // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
0935 // in them.
0936 message UninterpretedOption {
0937   // The name of the uninterpreted option.  Each string represents a segment in
0938   // a dot-separated name.  is_extension is true iff a segment represents an
0939   // extension (denoted with parentheses in options specs in .proto files).
0940   // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
0941   // "foo.(bar.baz).moo".
0942   message NamePart {
0943     required string name_part = 1;
0944     required bool is_extension = 2;
0945   }
0946   repeated NamePart name = 2;
0947 
0948   // The value of the uninterpreted option, in whatever type the tokenizer
0949   // identified it as during parsing. Exactly one of these should be set.
0950   optional string identifier_value = 3;
0951   optional uint64 positive_int_value = 4;
0952   optional int64 negative_int_value = 5;
0953   optional double double_value = 6;
0954   optional bytes string_value = 7;
0955   optional string aggregate_value = 8;
0956 }
0957 
0958 // ===================================================================
0959 // Features
0960 
0961 // TODO Enums in C++ gencode (and potentially other languages) are
0962 // not well scoped.  This means that each of the feature enums below can clash
0963 // with each other.  The short names we've chosen maximize call-site
0964 // readability, but leave us very open to this scenario.  A future feature will
0965 // be designed and implemented to handle this, hopefully before we ever hit a
0966 // conflict here.
0967 message FeatureSet {
0968   enum FieldPresence {
0969     FIELD_PRESENCE_UNKNOWN = 0;
0970     EXPLICIT = 1;
0971     IMPLICIT = 2;
0972     LEGACY_REQUIRED = 3;
0973   }
0974   optional FieldPresence field_presence = 1 [
0975     retention = RETENTION_RUNTIME,
0976     targets = TARGET_TYPE_FIELD,
0977     targets = TARGET_TYPE_FILE,
0978     feature_support = {
0979       edition_introduced: EDITION_2023,
0980     },
0981     edition_defaults = { edition: EDITION_LEGACY, value: "EXPLICIT" },
0982     edition_defaults = { edition: EDITION_PROTO3, value: "IMPLICIT" },
0983     edition_defaults = { edition: EDITION_2023, value: "EXPLICIT" }
0984   ];
0985 
0986   enum EnumType {
0987     ENUM_TYPE_UNKNOWN = 0;
0988     OPEN = 1;
0989     CLOSED = 2;
0990   }
0991   optional EnumType enum_type = 2 [
0992     retention = RETENTION_RUNTIME,
0993     targets = TARGET_TYPE_ENUM,
0994     targets = TARGET_TYPE_FILE,
0995     feature_support = {
0996       edition_introduced: EDITION_2023,
0997     },
0998     edition_defaults = { edition: EDITION_LEGACY, value: "CLOSED" },
0999     edition_defaults = { edition: EDITION_PROTO3, value: "OPEN" }
1000   ];
1001 
1002   enum RepeatedFieldEncoding {
1003     REPEATED_FIELD_ENCODING_UNKNOWN = 0;
1004     PACKED = 1;
1005     EXPANDED = 2;
1006   }
1007   optional RepeatedFieldEncoding repeated_field_encoding = 3 [
1008     retention = RETENTION_RUNTIME,
1009     targets = TARGET_TYPE_FIELD,
1010     targets = TARGET_TYPE_FILE,
1011     feature_support = {
1012       edition_introduced: EDITION_2023,
1013     },
1014     edition_defaults = { edition: EDITION_LEGACY, value: "EXPANDED" },
1015     edition_defaults = { edition: EDITION_PROTO3, value: "PACKED" }
1016   ];
1017 
1018   enum Utf8Validation {
1019     UTF8_VALIDATION_UNKNOWN = 0;
1020     VERIFY = 2;
1021     NONE = 3;
1022     reserved 1;
1023   }
1024   optional Utf8Validation utf8_validation = 4 [
1025     retention = RETENTION_RUNTIME,
1026     targets = TARGET_TYPE_FIELD,
1027     targets = TARGET_TYPE_FILE,
1028     feature_support = {
1029       edition_introduced: EDITION_2023,
1030     },
1031     edition_defaults = { edition: EDITION_LEGACY, value: "NONE" },
1032     edition_defaults = { edition: EDITION_PROTO3, value: "VERIFY" }
1033   ];
1034 
1035   enum MessageEncoding {
1036     MESSAGE_ENCODING_UNKNOWN = 0;
1037     LENGTH_PREFIXED = 1;
1038     DELIMITED = 2;
1039   }
1040   optional MessageEncoding message_encoding = 5 [
1041     retention = RETENTION_RUNTIME,
1042     targets = TARGET_TYPE_FIELD,
1043     targets = TARGET_TYPE_FILE,
1044     feature_support = {
1045       edition_introduced: EDITION_2023,
1046     },
1047     edition_defaults = { edition: EDITION_LEGACY, value: "LENGTH_PREFIXED" }
1048   ];
1049 
1050   enum JsonFormat {
1051     JSON_FORMAT_UNKNOWN = 0;
1052     ALLOW = 1;
1053     LEGACY_BEST_EFFORT = 2;
1054   }
1055   optional JsonFormat json_format = 6 [
1056     retention = RETENTION_RUNTIME,
1057     targets = TARGET_TYPE_MESSAGE,
1058     targets = TARGET_TYPE_ENUM,
1059     targets = TARGET_TYPE_FILE,
1060     feature_support = {
1061       edition_introduced: EDITION_2023,
1062     },
1063     edition_defaults = { edition: EDITION_LEGACY, value: "LEGACY_BEST_EFFORT" },
1064     edition_defaults = { edition: EDITION_PROTO3, value: "ALLOW" }
1065   ];
1066 
1067   reserved 999;
1068 
1069   extensions 1000 to 9994 [
1070     declaration = {
1071       number: 1000,
1072       full_name: ".pb.cpp",
1073       type: ".pb.CppFeatures"
1074     },
1075     declaration = {
1076       number: 1001,
1077       full_name: ".pb.java",
1078       type: ".pb.JavaFeatures"
1079     },
1080     declaration = { number: 1002, full_name: ".pb.go", type: ".pb.GoFeatures" },
1081     declaration = {
1082       number: 9990,
1083       full_name: ".pb.proto1",
1084       type: ".pb.Proto1Features"
1085     }
1086   ];
1087 
1088   extensions 9995 to 9999;  // For internal testing
1089   extensions 10000;         // for https://github.com/bufbuild/protobuf-es
1090 }
1091 
1092 // A compiled specification for the defaults of a set of features.  These
1093 // messages are generated from FeatureSet extensions and can be used to seed
1094 // feature resolution. The resolution with this object becomes a simple search
1095 // for the closest matching edition, followed by proto merges.
1096 message FeatureSetDefaults {
1097   // A map from every known edition with a unique set of defaults to its
1098   // defaults. Not all editions may be contained here.  For a given edition,
1099   // the defaults at the closest matching edition ordered at or before it should
1100   // be used.  This field must be in strict ascending order by edition.
1101   message FeatureSetEditionDefault {
1102     optional Edition edition = 3;
1103 
1104     // Defaults of features that can be overridden in this edition.
1105     optional FeatureSet overridable_features = 4;
1106 
1107     // Defaults of features that can't be overridden in this edition.
1108     optional FeatureSet fixed_features = 5;
1109 
1110     reserved 1, 2;
1111     reserved "features";
1112   }
1113   repeated FeatureSetEditionDefault defaults = 1;
1114 
1115   // The minimum supported edition (inclusive) when this was constructed.
1116   // Editions before this will not have defaults.
1117   optional Edition minimum_edition = 4;
1118 
1119   // The maximum known edition (inclusive) when this was constructed. Editions
1120   // after this will not have reliable defaults.
1121   optional Edition maximum_edition = 5;
1122 }
1123 
1124 // ===================================================================
1125 // Optional source code info
1126 
1127 // Encapsulates information about the original source file from which a
1128 // FileDescriptorProto was generated.
1129 message SourceCodeInfo {
1130   // A Location identifies a piece of source code in a .proto file which
1131   // corresponds to a particular definition.  This information is intended
1132   // to be useful to IDEs, code indexers, documentation generators, and similar
1133   // tools.
1134   //
1135   // For example, say we have a file like:
1136   //   message Foo {
1137   //     optional string foo = 1;
1138   //   }
1139   // Let's look at just the field definition:
1140   //   optional string foo = 1;
1141   //   ^       ^^     ^^  ^  ^^^
1142   //   a       bc     de  f  ghi
1143   // We have the following locations:
1144   //   span   path               represents
1145   //   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
1146   //   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
1147   //   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
1148   //   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
1149   //   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
1150   //
1151   // Notes:
1152   // - A location may refer to a repeated field itself (i.e. not to any
1153   //   particular index within it).  This is used whenever a set of elements are
1154   //   logically enclosed in a single code segment.  For example, an entire
1155   //   extend block (possibly containing multiple extension definitions) will
1156   //   have an outer location whose path refers to the "extensions" repeated
1157   //   field without an index.
1158   // - Multiple locations may have the same path.  This happens when a single
1159   //   logical declaration is spread out across multiple places.  The most
1160   //   obvious example is the "extend" block again -- there may be multiple
1161   //   extend blocks in the same scope, each of which will have the same path.
1162   // - A location's span is not always a subset of its parent's span.  For
1163   //   example, the "extendee" of an extension declaration appears at the
1164   //   beginning of the "extend" block and is shared by all extensions within
1165   //   the block.
1166   // - Just because a location's span is a subset of some other location's span
1167   //   does not mean that it is a descendant.  For example, a "group" defines
1168   //   both a type and a field in a single declaration.  Thus, the locations
1169   //   corresponding to the type and field and their components will overlap.
1170   // - Code which tries to interpret locations should probably be designed to
1171   //   ignore those that it doesn't understand, as more types of locations could
1172   //   be recorded in the future.
1173   repeated Location location = 1;
1174   message Location {
1175     // Identifies which part of the FileDescriptorProto was defined at this
1176     // location.
1177     //
1178     // Each element is a field number or an index.  They form a path from
1179     // the root FileDescriptorProto to the place where the definition appears.
1180     // For example, this path:
1181     //   [ 4, 3, 2, 7, 1 ]
1182     // refers to:
1183     //   file.message_type(3)  // 4, 3
1184     //       .field(7)         // 2, 7
1185     //       .name()           // 1
1186     // This is because FileDescriptorProto.message_type has field number 4:
1187     //   repeated DescriptorProto message_type = 4;
1188     // and DescriptorProto.field has field number 2:
1189     //   repeated FieldDescriptorProto field = 2;
1190     // and FieldDescriptorProto.name has field number 1:
1191     //   optional string name = 1;
1192     //
1193     // Thus, the above path gives the location of a field name.  If we removed
1194     // the last element:
1195     //   [ 4, 3, 2, 7 ]
1196     // this path refers to the whole field declaration (from the beginning
1197     // of the label to the terminating semicolon).
1198     repeated int32 path = 1 [packed = true];
1199 
1200     // Always has exactly three or four elements: start line, start column,
1201     // end line (optional, otherwise assumed same as start line), end column.
1202     // These are packed into a single field for efficiency.  Note that line
1203     // and column numbers are zero-based -- typically you will want to add
1204     // 1 to each before displaying to a user.
1205     repeated int32 span = 2 [packed = true];
1206 
1207     // If this SourceCodeInfo represents a complete declaration, these are any
1208     // comments appearing before and after the declaration which appear to be
1209     // attached to the declaration.
1210     //
1211     // A series of line comments appearing on consecutive lines, with no other
1212     // tokens appearing on those lines, will be treated as a single comment.
1213     //
1214     // leading_detached_comments will keep paragraphs of comments that appear
1215     // before (but not connected to) the current element. Each paragraph,
1216     // separated by empty lines, will be one comment element in the repeated
1217     // field.
1218     //
1219     // Only the comment content is provided; comment markers (e.g. //) are
1220     // stripped out.  For block comments, leading whitespace and an asterisk
1221     // will be stripped from the beginning of each line other than the first.
1222     // Newlines are included in the output.
1223     //
1224     // Examples:
1225     //
1226     //   optional int32 foo = 1;  // Comment attached to foo.
1227     //   // Comment attached to bar.
1228     //   optional int32 bar = 2;
1229     //
1230     //   optional string baz = 3;
1231     //   // Comment attached to baz.
1232     //   // Another line attached to baz.
1233     //
1234     //   // Comment attached to moo.
1235     //   //
1236     //   // Another line attached to moo.
1237     //   optional double moo = 4;
1238     //
1239     //   // Detached comment for corge. This is not leading or trailing comments
1240     //   // to moo or corge because there are blank lines separating it from
1241     //   // both.
1242     //
1243     //   // Detached comment for corge paragraph 2.
1244     //
1245     //   optional string corge = 5;
1246     //   /* Block comment attached
1247     //    * to corge.  Leading asterisks
1248     //    * will be removed. */
1249     //   /* Block comment attached to
1250     //    * grault. */
1251     //   optional int32 grault = 6;
1252     //
1253     //   // ignored detached comments.
1254     optional string leading_comments = 3;
1255     optional string trailing_comments = 4;
1256     repeated string leading_detached_comments = 6;
1257   }
1258 }
1259 
1260 // Describes the relationship between generated code and its original source
1261 // file. A GeneratedCodeInfo message is associated with only one generated
1262 // source file, but may contain references to different source .proto files.
1263 message GeneratedCodeInfo {
1264   // An Annotation connects some span of text in generated code to an element
1265   // of its generating .proto file.
1266   repeated Annotation annotation = 1;
1267   message Annotation {
1268     // Identifies the element in the original source .proto file. This field
1269     // is formatted the same as SourceCodeInfo.Location.path.
1270     repeated int32 path = 1 [packed = true];
1271 
1272     // Identifies the filesystem path to the original source .proto.
1273     optional string source_file = 2;
1274 
1275     // Identifies the starting offset in bytes in the generated code
1276     // that relates to the identified object.
1277     optional int32 begin = 3;
1278 
1279     // Identifies the ending offset in bytes in the generated code that
1280     // relates to the identified object. The end offset should be one past
1281     // the last relevant byte (so the length of the text = end - begin).
1282     optional int32 end = 4;
1283 
1284     // Represents the identified object's effect on the element in the original
1285     // .proto file.
1286     enum Semantic {
1287       // There is no effect or the effect is indescribable.
1288       NONE = 0;
1289       // The element is set or otherwise mutated.
1290       SET = 1;
1291       // An alias to the element is returned.
1292       ALIAS = 2;
1293     }
1294     optional Semantic semantic = 5;
1295   }
1296 }