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