github.com/jhump/protoreflect@v1.16.0/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, retention = RETENTION_SOURCE]; 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 VERIFY = 2; 308 309 NONE = 3; 310 } 311 312 extensions 1000, 1001, 1002, 9995 to 9999, 10000; 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 belong to a oneof to signal 388 // to old proto3 clients that presence is tracked for this field. This oneof 389 // is known as a "synthetic" oneof, and this field must be its sole member 390 // (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs 391 // exist in the descriptor only, and do not generate any API. Synthetic oneofs 392 // 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 lazy message fields are still eagerly verified to check 512 // ill-formed wireformat or missing required fields. Calling IsInitialized() 513 // on the outer message would fail if the inner message has missing required 514 // fields. Failed verification would result in parsing failure (except when 515 // uninitialized messages are acceptable). 516 optional bool lazy = 5 [default = false]; 517 518 // The jstype option determines the JavaScript type used for values of the 519 // field. The option is permitted only for 64 bit integral and fixed types 520 // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING 521 // is represented as JavaScript string, which avoids loss of precision that 522 // can happen when a large value is converted to a floating point JavaScript. 523 // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to 524 // use the JavaScript "number" type. The behavior of the default option 525 // JS_NORMAL is implementation dependent. 526 // 527 // This option is an enum to permit additional types to be added, e.g. 528 // goog.math.Integer. 529 optional JSType jstype = 6 [default = JS_NORMAL]; 530 531 // For Google-internal migration only. Do not use. 532 optional bool weak = 10 [default = false]; 533 534 // unverified_lazy does no correctness checks on the byte stream. This should 535 // only be used where lazy with verification is prohibitive for performance 536 // reasons. 537 optional bool unverified_lazy = 15 [default = false]; 538 539 // Indicate that the field value should not be printed out when using debug 540 // formats, e.g. when the field contains sensitive credentials. 541 optional bool debug_redact = 16 [default = false]; 542 543 optional OptionRetention retention = 17; 544 545 repeated OptionTargetType targets = 19; 546 547 repeated EditionDefault edition_defaults = 20; 548 549 // Any features defined in the specific edition. 550 optional FeatureSet features = 21; 551 552 // The parser stores options it doesn't recognize here. See above. 553 repeated UninterpretedOption uninterpreted_option = 999; 554 555 message EditionDefault { 556 optional string value = 2; // Textproto value. 557 558 optional Edition edition = 3; 559 } 560 561 enum CType { 562 // Default mode. 563 STRING = 0; 564 565 // The option [ctype=CORD] may be applied to a non-repeated field of type 566 // "bytes". It indicates that in C++, the data should be stored in a Cord 567 // instead of a string. For very large strings, this may reduce memory 568 // fragmentation. It may also allow better performance when parsing from a 569 // Cord, or when parsing with aliasing enabled, as the parsed Cord may then 570 // alias the original buffer. 571 CORD = 1; 572 573 STRING_PIECE = 2; 574 } 575 576 enum JSType { 577 // Use the default type. 578 JS_NORMAL = 0; 579 580 // Use JavaScript strings. 581 JS_STRING = 1; 582 583 // Use JavaScript numbers. 584 JS_NUMBER = 2; 585 } 586 587 // If set to RETENTION_SOURCE, the option will be omitted from the binary. 588 // Note: as of January 2023, support for this is in progress and does not yet 589 // have an effect (b/264593489). 590 enum OptionRetention { 591 RETENTION_UNKNOWN = 0; 592 593 RETENTION_RUNTIME = 1; 594 595 RETENTION_SOURCE = 2; 596 } 597 598 // This indicates the types of entities that the field may apply to when used 599 // as an option. If it is unset, then the field may be freely used as an 600 // option on any kind of entity. Note: as of January 2023, support for this is 601 // in progress and does not yet have an effect (b/264593489). 602 enum OptionTargetType { 603 TARGET_TYPE_UNKNOWN = 0; 604 605 TARGET_TYPE_FILE = 1; 606 607 TARGET_TYPE_EXTENSION_RANGE = 2; 608 609 TARGET_TYPE_MESSAGE = 3; 610 611 TARGET_TYPE_FIELD = 4; 612 613 TARGET_TYPE_ONEOF = 5; 614 615 TARGET_TYPE_ENUM = 6; 616 617 TARGET_TYPE_ENUM_ENTRY = 7; 618 619 TARGET_TYPE_SERVICE = 8; 620 621 TARGET_TYPE_METHOD = 9; 622 } 623 624 extensions 1000 to max; 625 626 reserved 4, 18; 627 } 628 629 // Describes a complete .proto file. 630 message FileDescriptorProto { 631 optional string name = 1; // file name, relative to root of source tree 632 633 optional string package = 2; // e.g. "foo", "foo.bar", etc. 634 635 // Names of files imported by this file. 636 repeated string dependency = 3; 637 638 // All top-level definitions in this file. 639 repeated DescriptorProto message_type = 4; 640 641 repeated EnumDescriptorProto enum_type = 5; 642 643 repeated ServiceDescriptorProto service = 6; 644 645 repeated FieldDescriptorProto extension = 7; 646 647 optional FileOptions options = 8; 648 649 // This field contains optional information about the original source code. 650 // You may safely remove this entire field without harming runtime 651 // functionality of the descriptors -- the information is needed only by 652 // development tools. 653 optional SourceCodeInfo source_code_info = 9; 654 655 // Indexes of the public imported files in the dependency list above. 656 repeated int32 public_dependency = 10; 657 658 // Indexes of the weak imported files in the dependency list. 659 // For Google-internal migration only. Do not use. 660 repeated int32 weak_dependency = 11; 661 662 // The syntax of the proto file. 663 // The supported values are "proto2", "proto3", and "editions". 664 // 665 // If `edition` is present, this value must be "editions". 666 optional string syntax = 12; 667 668 // The edition of the proto file. 669 optional Edition edition = 14; 670 } 671 672 // The protocol compiler can output a FileDescriptorSet containing the .proto 673 // files it parses. 674 message FileDescriptorSet { 675 repeated FileDescriptorProto file = 1; 676 } 677 678 message FileOptions { 679 // Sets the Java package where classes generated from this .proto will be 680 // placed. By default, the proto package is used, but this is often 681 // inappropriate because proto packages do not normally start with backwards 682 // domain names. 683 optional string java_package = 1; 684 685 // Controls the name of the wrapper Java class generated for the .proto file. 686 // That class will always contain the .proto file's getDescriptor() method as 687 // well as any top-level extensions defined in the .proto file. 688 // If java_multiple_files is disabled, then all the other classes from the 689 // .proto file will be nested inside the single wrapper outer class. 690 optional string java_outer_classname = 8; 691 692 optional OptimizeMode optimize_for = 9 [default = SPEED]; 693 694 // If enabled, then the Java code generator will generate a separate .java 695 // file for each top-level message, enum, and service defined in the .proto 696 // file. Thus, these types will *not* be nested inside the wrapper class 697 // named by java_outer_classname. However, the wrapper class will still be 698 // generated to contain the file's getDescriptor() method as well as any 699 // top-level extensions defined in the file. 700 optional bool java_multiple_files = 10 [default = false]; 701 702 // Sets the Go package where structs generated from this .proto will be 703 // placed. If omitted, the Go package will be derived from the following: 704 // - The basename of the package import path, if provided. 705 // - Otherwise, the package statement in the .proto file, if present. 706 // - Otherwise, the basename of the .proto file, without extension. 707 optional string go_package = 11; 708 709 // Should generic services be generated in each language? "Generic" services 710 // are not specific to any particular RPC system. They are generated by the 711 // main code generators in each language (without additional plugins). 712 // Generic services were the only kind of service generation supported by 713 // early versions of google.protobuf. 714 // 715 // Generic services are now considered deprecated in favor of using plugins 716 // that generate code specific to your particular RPC system. Therefore, 717 // these default to false. Old code which depends on generic services should 718 // explicitly set them to true. 719 optional bool cc_generic_services = 16 [default = false]; 720 721 optional bool java_generic_services = 17 [default = false]; 722 723 optional bool py_generic_services = 18 [default = false]; 724 725 // This option does nothing. 726 optional bool java_generate_equals_and_hash = 20 [deprecated = true]; 727 728 // Is this file deprecated? 729 // Depending on the target platform, this can emit Deprecated annotations 730 // for everything in the file, or it will be completely ignored; in the very 731 // least, this is a formalization for deprecating files. 732 optional bool deprecated = 23 [default = false]; 733 734 // If set true, then the Java2 code generator will generate code that 735 // throws an exception whenever an attempt is made to assign a non-UTF-8 736 // byte sequence to a string field. 737 // Message reflection will do the same. 738 // However, an extension field still accepts non-UTF-8 byte sequences. 739 // This option has no effect on when used with the lite runtime. 740 optional bool java_string_check_utf8 = 27 [default = false]; 741 742 // Enables the use of arenas for the proto messages in this file. This applies 743 // only to generated classes for C++. 744 optional bool cc_enable_arenas = 31 [default = true]; 745 746 // Sets the objective c class prefix which is prepended to all objective c 747 // generated classes from this .proto. There is no default. 748 optional string objc_class_prefix = 36; 749 750 // Namespace for generated classes; defaults to the package. 751 optional string csharp_namespace = 37; 752 753 // By default Swift generators will take the proto package and CamelCase it 754 // replacing '.' with underscore and use that to prefix the types/symbols 755 // defined. When this options is provided, they will use this value instead 756 // to prefix the types/symbols defined. 757 optional string swift_prefix = 39; 758 759 // Sets the php class prefix which is prepended to all php generated classes 760 // from this .proto. Default is empty. 761 optional string php_class_prefix = 40; 762 763 // Use this option to change the namespace of php generated classes. Default 764 // is empty. When this option is empty, the package name will be used for 765 // determining the namespace. 766 optional string php_namespace = 41; 767 768 // Use this option to change the namespace of php generated metadata classes. 769 // Default is empty. When this option is empty, the proto file name will be 770 // used for determining the namespace. 771 optional string php_metadata_namespace = 44; 772 773 // Use this option to change the package of ruby generated classes. Default 774 // is empty. When this option is not set, the package name will be used for 775 // determining the ruby package. 776 optional string ruby_package = 45; 777 778 // Any features defined in the specific edition. 779 optional FeatureSet features = 50; 780 781 // The parser stores options it doesn't recognize here. 782 // See the documentation for the "Options" section above. 783 repeated UninterpretedOption uninterpreted_option = 999; 784 785 // Generated classes can be optimized for speed or code size. 786 enum OptimizeMode { 787 SPEED = 1; // Generate complete code for parsing, serialization, 788 789 // etc. 790 CODE_SIZE = 2; // Use ReflectionOps to implement these methods. 791 792 LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. 793 } 794 795 extensions 1000 to max; 796 797 reserved 38, 42; 798 } 799 800 // Describes the relationship between generated code and its original source 801 // file. A GeneratedCodeInfo message is associated with only one generated 802 // source file, but may contain references to different source .proto files. 803 message GeneratedCodeInfo { 804 // An Annotation connects some span of text in generated code to an element 805 // of its generating .proto file. 806 repeated Annotation annotation = 1; 807 808 message Annotation { 809 // Identifies the element in the original source .proto file. This field 810 // is formatted the same as SourceCodeInfo.Location.path. 811 repeated int32 path = 1 [packed = true]; 812 813 // Identifies the filesystem path to the original source .proto. 814 optional string source_file = 2; 815 816 // Identifies the starting offset in bytes in the generated code 817 // that relates to the identified object. 818 optional int32 begin = 3; 819 820 // Identifies the ending offset in bytes in the generated code that 821 // relates to the identified object. The end offset should be one past 822 // the last relevant byte (so the length of the text = end - begin). 823 optional int32 end = 4; 824 825 optional Semantic semantic = 5; 826 827 // Represents the identified object's effect on the element in the original 828 // .proto file. 829 enum Semantic { 830 // There is no effect or the effect is indescribable. 831 NONE = 0; 832 833 // The element is set or otherwise mutated. 834 SET = 1; 835 836 // An alias to the element is returned. 837 ALIAS = 2; 838 } 839 } 840 } 841 842 message MessageOptions { 843 // Set true to use the old proto1 MessageSet wire format for extensions. 844 // This is provided for backwards-compatibility with the MessageSet wire 845 // format. You should not use this for any other reason: It's less 846 // efficient, has fewer features, and is more complicated. 847 // 848 // The message must be defined exactly as follows: 849 // message Foo { 850 // option message_set_wire_format = true; 851 // extensions 4 to max; 852 // } 853 // Note that the message cannot have any defined fields; MessageSets only 854 // have extensions. 855 // 856 // All extensions of your type must be singular messages; e.g. they cannot 857 // be int32s, enums, or repeated messages. 858 // 859 // Because this is an option, the above two restrictions are not enforced by 860 // the protocol compiler. 861 optional bool message_set_wire_format = 1 [default = false]; 862 863 // Disables the generation of the standard "descriptor()" accessor, which can 864 // conflict with a field of the same name. This is meant to make migration 865 // from proto1 easier; new code should avoid fields named "descriptor". 866 optional bool no_standard_descriptor_accessor = 2 [default = false]; 867 868 // Is this message deprecated? 869 // Depending on the target platform, this can emit Deprecated annotations 870 // for the message, or it will be completely ignored; in the very least, 871 // this is a formalization for deprecating messages. 872 optional bool deprecated = 3 [default = false]; 873 874 // Whether the message is an automatically generated map entry type for the 875 // maps field. 876 // 877 // For maps fields: 878 // map<KeyType, ValueType> map_field = 1; 879 // The parsed descriptor looks like: 880 // message MapFieldEntry { 881 // option map_entry = true; 882 // optional KeyType key = 1; 883 // optional ValueType value = 2; 884 // } 885 // repeated MapFieldEntry map_field = 1; 886 // 887 // Implementations may choose not to generate the map_entry=true message, but 888 // use a native map in the target language to hold the keys and values. 889 // The reflection APIs in such implementations still need to work as 890 // if the field is a repeated message field. 891 // 892 // NOTE: Do not set the option in .proto files. Always use the maps syntax 893 // instead. The option should only be implicitly set by the proto compiler 894 // parser. 895 optional bool map_entry = 7; 896 897 // Enable the legacy handling of JSON field name conflicts. This lowercases 898 // and strips underscored from the fields before comparison in proto3 only. 899 // The new behavior takes `json_name` into account and applies to proto2 as 900 // well. 901 // 902 // This should only be used as a temporary measure against broken builds due 903 // to the change in behavior for JSON field name conflicts. 904 // 905 // TODO This is legacy behavior we plan to remove once downstream 906 // teams have had time to migrate. 907 optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; 908 909 // Any features defined in the specific edition. 910 optional FeatureSet features = 12; 911 912 // The parser stores options it doesn't recognize here. See above. 913 repeated UninterpretedOption uninterpreted_option = 999; 914 915 extensions 1000 to max; 916 917 reserved 4, 5, 6, 8, 9; 918 } 919 920 // Describes a method of a service. 921 message MethodDescriptorProto { 922 optional string name = 1; 923 924 // Input and output type names. These are resolved in the same way as 925 // FieldDescriptorProto.type_name, but must refer to a message type. 926 optional string input_type = 2; 927 928 optional string output_type = 3; 929 930 optional MethodOptions options = 4; 931 932 // Identifies if client streams multiple client messages 933 optional bool client_streaming = 5 [default = false]; 934 935 // Identifies if server streams multiple server messages 936 optional bool server_streaming = 6 [default = false]; 937 } 938 939 message MethodOptions { 940 // Is this method deprecated? 941 // Depending on the target platform, this can emit Deprecated annotations 942 // for the method, or it will be completely ignored; in the very least, 943 // this is a formalization for deprecating methods. 944 optional bool deprecated = 33 [default = false]; 945 946 optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; 947 948 // Any features defined in the specific edition. 949 optional FeatureSet features = 35; 950 951 // The parser stores options it doesn't recognize here. See above. 952 repeated UninterpretedOption uninterpreted_option = 999; 953 954 // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, 955 // or neither? HTTP based RPC implementation may choose GET verb for safe 956 // methods, and PUT verb for idempotent methods instead of the default POST. 957 enum IdempotencyLevel { 958 IDEMPOTENCY_UNKNOWN = 0; 959 960 NO_SIDE_EFFECTS = 1; // implies idempotent 961 962 IDEMPOTENT = 2; // idempotent, but may have side effects 963 } 964 965 extensions 1000 to max; 966 } 967 968 // Describes a oneof. 969 message OneofDescriptorProto { 970 optional string name = 1; 971 972 optional OneofOptions options = 2; 973 } 974 975 message OneofOptions { 976 // Any features defined in the specific edition. 977 optional FeatureSet features = 1; 978 979 // The parser stores options it doesn't recognize here. See above. 980 repeated UninterpretedOption uninterpreted_option = 999; 981 982 extensions 1000 to max; 983 } 984 985 // Describes a service. 986 message ServiceDescriptorProto { 987 optional string name = 1; 988 989 repeated MethodDescriptorProto method = 2; 990 991 optional ServiceOptions options = 3; 992 } 993 994 message ServiceOptions { 995 // Is this service deprecated? 996 // Depending on the target platform, this can emit Deprecated annotations 997 // for the service, or it will be completely ignored; in the very least, 998 // this is a formalization for deprecating services. 999 optional bool deprecated = 33 [default = false]; 1000 1001 // Any features defined in the specific edition. 1002 optional FeatureSet features = 34; 1003 1004 // The parser stores options it doesn't recognize here. See above. 1005 repeated UninterpretedOption uninterpreted_option = 999; 1006 1007 extensions 1000 to max; 1008 } 1009 1010 // Encapsulates information about the original source file from which a 1011 // FileDescriptorProto was generated. 1012 message SourceCodeInfo { 1013 // A Location identifies a piece of source code in a .proto file which 1014 // corresponds to a particular definition. This information is intended 1015 // to be useful to IDEs, code indexers, documentation generators, and similar 1016 // tools. 1017 // 1018 // For example, say we have a file like: 1019 // message Foo { 1020 // optional string foo = 1; 1021 // } 1022 // Let's look at just the field definition: 1023 // optional string foo = 1; 1024 // ^ ^^ ^^ ^ ^^^ 1025 // a bc de f ghi 1026 // We have the following locations: 1027 // span path represents 1028 // [a,i) [ 4, 0, 2, 0 ] The whole field definition. 1029 // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). 1030 // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). 1031 // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). 1032 // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). 1033 // 1034 // Notes: 1035 // - A location may refer to a repeated field itself (i.e. not to any 1036 // particular index within it). This is used whenever a set of elements are 1037 // logically enclosed in a single code segment. For example, an entire 1038 // extend block (possibly containing multiple extension definitions) will 1039 // have an outer location whose path refers to the "extensions" repeated 1040 // field without an index. 1041 // - Multiple locations may have the same path. This happens when a single 1042 // logical declaration is spread out across multiple places. The most 1043 // obvious example is the "extend" block again -- there may be multiple 1044 // extend blocks in the same scope, each of which will have the same path. 1045 // - A location's span is not always a subset of its parent's span. For 1046 // example, the "extendee" of an extension declaration appears at the 1047 // beginning of the "extend" block and is shared by all extensions within 1048 // the block. 1049 // - Just because a location's span is a subset of some other location's span 1050 // does not mean that it is a descendant. For example, a "group" defines 1051 // both a type and a field in a single declaration. Thus, the locations 1052 // corresponding to the type and field and their components will overlap. 1053 // - Code which tries to interpret locations should probably be designed to 1054 // ignore those that it doesn't understand, as more types of locations could 1055 // be recorded in the future. 1056 repeated Location location = 1; 1057 1058 message Location { 1059 // Identifies which part of the FileDescriptorProto was defined at this 1060 // location. 1061 // 1062 // Each element is a field number or an index. They form a path from 1063 // the root FileDescriptorProto to the place where the definition appears. 1064 // For example, this path: 1065 // [ 4, 3, 2, 7, 1 ] 1066 // refers to: 1067 // file.message_type(3) // 4, 3 1068 // .field(7) // 2, 7 1069 // .name() // 1 1070 // This is because FileDescriptorProto.message_type has field number 4: 1071 // repeated DescriptorProto message_type = 4; 1072 // and DescriptorProto.field has field number 2: 1073 // repeated FieldDescriptorProto field = 2; 1074 // and FieldDescriptorProto.name has field number 1: 1075 // optional string name = 1; 1076 // 1077 // Thus, the above path gives the location of a field name. If we removed 1078 // the last element: 1079 // [ 4, 3, 2, 7 ] 1080 // this path refers to the whole field declaration (from the beginning 1081 // of the label to the terminating semicolon). 1082 repeated int32 path = 1 [packed = true]; 1083 1084 // Always has exactly three or four elements: start line, start column, 1085 // end line (optional, otherwise assumed same as start line), end column. 1086 // These are packed into a single field for efficiency. Note that line 1087 // and column numbers are zero-based -- typically you will want to add 1088 // 1 to each before displaying to a user. 1089 repeated int32 span = 2 [packed = true]; 1090 1091 // If this SourceCodeInfo represents a complete declaration, these are any 1092 // comments appearing before and after the declaration which appear to be 1093 // attached to the declaration. 1094 // 1095 // A series of line comments appearing on consecutive lines, with no other 1096 // tokens appearing on those lines, will be treated as a single comment. 1097 // 1098 // leading_detached_comments will keep paragraphs of comments that appear 1099 // before (but not connected to) the current element. Each paragraph, 1100 // separated by empty lines, will be one comment element in the repeated 1101 // field. 1102 // 1103 // Only the comment content is provided; comment markers (e.g. //) are 1104 // stripped out. For block comments, leading whitespace and an asterisk 1105 // will be stripped from the beginning of each line other than the first. 1106 // Newlines are included in the output. 1107 // 1108 // Examples: 1109 // 1110 // optional int32 foo = 1; // Comment attached to foo. 1111 // // Comment attached to bar. 1112 // optional int32 bar = 2; 1113 // 1114 // optional string baz = 3; 1115 // // Comment attached to baz. 1116 // // Another line attached to baz. 1117 // 1118 // // Comment attached to moo. 1119 // // 1120 // // Another line attached to moo. 1121 // optional double moo = 4; 1122 // 1123 // // Detached comment for corge. This is not leading or trailing comments 1124 // // to moo or corge because there are blank lines separating it from 1125 // // both. 1126 // 1127 // // Detached comment for corge paragraph 2. 1128 // 1129 // optional string corge = 5; 1130 // /* Block comment attached 1131 // * to corge. Leading asterisks 1132 // * will be removed. */ 1133 // /* Block comment attached to 1134 // * grault. */ 1135 // optional int32 grault = 6; 1136 // 1137 // // ignored detached comments. 1138 optional string leading_comments = 3; 1139 1140 optional string trailing_comments = 4; 1141 1142 repeated string leading_detached_comments = 6; 1143 } 1144 } 1145 1146 // A message representing a option the parser does not recognize. This only 1147 // appears in options protos created by the compiler::Parser class. 1148 // DescriptorPool resolves these when building Descriptor objects. Therefore, 1149 // options protos in descriptor objects (e.g. returned by Descriptor::options(), 1150 // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions 1151 // in them. 1152 message UninterpretedOption { 1153 repeated NamePart name = 2; 1154 1155 // The value of the uninterpreted option, in whatever type the tokenizer 1156 // identified it as during parsing. Exactly one of these should be set. 1157 optional string identifier_value = 3; 1158 1159 optional uint64 positive_int_value = 4; 1160 1161 optional int64 negative_int_value = 5; 1162 1163 optional double double_value = 6; 1164 1165 optional bytes string_value = 7; 1166 1167 optional string aggregate_value = 8; 1168 1169 // The name of the uninterpreted option. Each string represents a segment in 1170 // a dot-separated name. is_extension is true iff a segment represents an 1171 // extension (denoted with parentheses in options specs in .proto files). 1172 // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents 1173 // "foo.(bar.baz).moo". 1174 message NamePart { 1175 required string name_part = 1; 1176 1177 required bool is_extension = 2; 1178 } 1179 } 1180 1181 // The full set of known editions. 1182 enum Edition { 1183 // A placeholder for an unknown edition value. 1184 EDITION_UNKNOWN = 0; 1185 1186 // Placeholder editions for testing feature resolution. These should not be 1187 // used or relyed on outside of tests. 1188 EDITION_1_TEST_ONLY = 1; 1189 1190 EDITION_2_TEST_ONLY = 2; 1191 1192 // Legacy syntax "editions". These pre-date editions, but behave much like 1193 // distinct editions. These can't be used to specify the edition of proto 1194 // files, but feature definitions must supply proto2/proto3 defaults for 1195 // backwards compatibility. 1196 EDITION_PROTO2 = 998; 1197 1198 EDITION_PROTO3 = 999; 1199 1200 // Editions that have been released. The specific values are arbitrary and 1201 // should not be depended on, but they will always be time-ordered for easy 1202 // comparison. 1203 EDITION_2023 = 1000; 1204 1205 EDITION_2024 = 1001; 1206 1207 EDITION_99997_TEST_ONLY = 99997; 1208 1209 EDITION_99998_TEST_ONLY = 99998; 1210 1211 EDITION_99999_TEST_ONLY = 99999; 1212 1213 // Placeholder for specifying unbounded edition support. This should only 1214 // ever be used by plugins that can expect to never require any changes to 1215 // support a new edition. 1216 EDITION_MAX = 2147483647; 1217 }