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

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