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