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