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