github.com/hoveychen/protoreflect@v1.4.7-0.20221103114119-0b4b3385ec76/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 = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; 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 /* Describes a complete .proto file. */ 74 message FileDescriptorProto { 75 optional string name = 1; /* file name, relative to root of source tree */ 76 77 optional string package = 2; /* e.g. "foo", "foo.bar", etc. */ 78 79 /* Names of files imported by this file. */ 80 repeated string dependency = 3; 81 82 /* Indexes of the public imported files in the dependency list above. */ 83 repeated int32 public_dependency = 10; 84 85 /* 86 * Indexes of the weak imported files in the dependency list. 87 * For Google-internal migration only. Do not use. 88 */ 89 repeated int32 weak_dependency = 11; 90 91 /* All top-level definitions in this file. */ 92 repeated DescriptorProto message_type = 4; 93 94 repeated EnumDescriptorProto enum_type = 5; 95 96 repeated ServiceDescriptorProto service = 6; 97 98 repeated FieldDescriptorProto extension = 7; 99 100 optional FileOptions options = 8; 101 102 /* 103 * This field contains optional information about the original source code. 104 * You may safely remove this entire field without harming runtime 105 * functionality of the descriptors -- the information is needed only by 106 * development tools. 107 */ 108 optional SourceCodeInfo source_code_info = 9; 109 110 /* 111 * The syntax of the proto file. 112 * The supported values are "proto2" and "proto3". 113 */ 114 optional string syntax = 12; 115 } 116 117 /* Describes a message type. */ 118 message DescriptorProto { 119 optional string name = 1; 120 121 repeated FieldDescriptorProto field = 2; 122 123 repeated FieldDescriptorProto extension = 6; 124 125 repeated DescriptorProto nested_type = 3; 126 127 repeated EnumDescriptorProto enum_type = 4; 128 129 message ExtensionRange { 130 optional int32 start = 1; /* Inclusive. */ 131 132 optional int32 end = 2; /* Exclusive. */ 133 134 optional ExtensionRangeOptions options = 3; 135 } 136 137 repeated ExtensionRange extension_range = 5; 138 139 repeated OneofDescriptorProto oneof_decl = 8; 140 141 optional MessageOptions options = 7; 142 143 /* 144 * Range of reserved tag numbers. Reserved tag numbers may not be used by 145 * fields or extension ranges in the same message. Reserved ranges may 146 * not overlap. 147 */ 148 message ReservedRange { 149 optional int32 start = 1; /* Inclusive. */ 150 151 optional int32 end = 2; /* Exclusive. */ 152 } 153 154 repeated ReservedRange reserved_range = 9; 155 156 /* 157 * Reserved field names, which may not be used by fields in the same message. 158 * A given name may only be reserved once. 159 */ 160 repeated string reserved_name = 10; 161 } 162 163 message ExtensionRangeOptions { 164 /* The parser stores options it doesn't recognize here. See above. */ 165 repeated UninterpretedOption uninterpreted_option = 999; 166 167 extensions 1000 to max; 168 } 169 170 /* Describes a field within a message. */ 171 message FieldDescriptorProto { 172 enum Type { 173 /* 174 * 0 is reserved for errors. 175 * Order is weird for historical reasons. 176 */ 177 TYPE_DOUBLE = 1; 178 179 TYPE_FLOAT = 2; 180 181 /* 182 * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if 183 * negative values are likely. 184 */ 185 TYPE_INT64 = 3; 186 187 TYPE_UINT64 = 4; 188 189 /* 190 * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if 191 * negative values are likely. 192 */ 193 TYPE_INT32 = 5; 194 195 TYPE_FIXED64 = 6; 196 197 TYPE_FIXED32 = 7; 198 199 TYPE_BOOL = 8; 200 201 TYPE_STRING = 9; 202 203 /* 204 * Tag-delimited aggregate. 205 * Group type is deprecated and not supported in proto3. However, Proto3 206 * implementations should still be able to parse the group wire format and 207 * treat group fields as unknown fields. 208 */ 209 TYPE_GROUP = 10; 210 211 TYPE_MESSAGE = 11; /* Length-delimited aggregate. */ 212 213 /* New in version 2. */ 214 TYPE_BYTES = 12; 215 216 TYPE_UINT32 = 13; 217 218 TYPE_ENUM = 14; 219 220 TYPE_SFIXED32 = 15; 221 222 TYPE_SFIXED64 = 16; 223 224 TYPE_SINT32 = 17; /* Uses ZigZag encoding. */ 225 226 TYPE_SINT64 = 18; /* Uses ZigZag encoding. */ 227 } 228 229 enum Label { 230 /* 0 is reserved for errors */ 231 LABEL_OPTIONAL = 1; 232 233 LABEL_REQUIRED = 2; 234 235 LABEL_REPEATED = 3; 236 } 237 238 optional string name = 1; 239 240 optional int32 number = 3; 241 242 optional Label label = 4; 243 244 /* 245 * If type_name is set, this need not be set. If both this and type_name 246 * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. 247 */ 248 optional Type type = 5; 249 250 /* 251 * For message and enum types, this is the name of the type. If the name 252 * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping 253 * rules are used to find the type (i.e. first the nested types within this 254 * message are searched, then within the parent, on up to the root 255 * namespace). 256 */ 257 optional string type_name = 6; 258 259 /* 260 * For extensions, this is the name of the type being extended. It is 261 * resolved in the same manner as type_name. 262 */ 263 optional string extendee = 2; 264 265 /* 266 * For numeric types, contains the original text representation of the value. 267 * For booleans, "true" or "false". 268 * For strings, contains the default text contents (not escaped in any way). 269 * For bytes, contains the C escaped value. All bytes >= 128 are escaped. 270 * TODO(kenton): Base-64 encode? 271 */ 272 optional string default_value = 7; 273 274 /* 275 * If set, gives the index of a oneof in the containing type's oneof_decl 276 * list. This field is a member of that oneof. 277 */ 278 optional int32 oneof_index = 9; 279 280 /* 281 * JSON name of this field. The value is set by protocol compiler. If the 282 * user has set a "json_name" option on this field, that option's value 283 * will be used. Otherwise, it's deduced from the field's name by converting 284 * it to camelCase. 285 */ 286 optional string json_name = 10; 287 288 optional FieldOptions options = 8; 289 } 290 291 /* Describes a oneof. */ 292 message OneofDescriptorProto { 293 optional string name = 1; 294 295 optional OneofOptions options = 2; 296 } 297 298 /* Describes an enum type. */ 299 message EnumDescriptorProto { 300 optional string name = 1; 301 302 repeated EnumValueDescriptorProto value = 2; 303 304 optional EnumOptions options = 3; 305 306 /* 307 * Range of reserved numeric values. Reserved values may not be used by 308 * entries in the same enum. Reserved ranges may not overlap. 309 * 310 * Note that this is distinct from DescriptorProto.ReservedRange in that it 311 * is inclusive such that it can appropriately represent the entire int32 312 * domain. 313 */ 314 message EnumReservedRange { 315 optional int32 start = 1; /* Inclusive. */ 316 317 optional int32 end = 2; /* Inclusive. */ 318 } 319 320 /* 321 * Range of reserved numeric values. Reserved numeric values may not be used 322 * by enum values in the same enum declaration. Reserved ranges may not 323 * overlap. 324 */ 325 repeated EnumReservedRange reserved_range = 4; 326 327 /* 328 * Reserved enum value names, which may not be reused. A given name may only 329 * be reserved once. 330 */ 331 repeated string reserved_name = 5; 332 } 333 334 /* Describes a value within an enum. */ 335 message EnumValueDescriptorProto { 336 optional string name = 1; 337 338 optional int32 number = 2; 339 340 optional EnumValueOptions options = 3; 341 } 342 343 /* Describes a service. */ 344 message ServiceDescriptorProto { 345 optional string name = 1; 346 347 repeated MethodDescriptorProto method = 2; 348 349 optional ServiceOptions options = 3; 350 } 351 352 /* Describes a method of a service. */ 353 message MethodDescriptorProto { 354 optional string name = 1; 355 356 /* 357 * Input and output type names. These are resolved in the same way as 358 * FieldDescriptorProto.type_name, but must refer to a message type. 359 */ 360 optional string input_type = 2; 361 362 optional string output_type = 3; 363 364 optional MethodOptions options = 4; 365 366 /* Identifies if client streams multiple client messages */ 367 optional bool client_streaming = 5 [default = false]; 368 369 /* Identifies if server streams multiple server messages */ 370 optional bool server_streaming = 6 [default = false]; 371 } 372 373 /* 374 * =================================================================== 375 * Options 376 */ 377 378 /* 379 * Each of the definitions above may have "options" attached. These are 380 * just annotations which may cause code to be generated slightly differently 381 * or may contain hints for code that manipulates protocol messages. 382 * 383 * Clients may define custom options as extensions of the *Options messages. 384 * These extensions may not yet be known at parsing time, so the parser cannot 385 * store the values in them. Instead it stores them in a field in the *Options 386 * message called uninterpreted_option. This field must have the same name 387 * across all *Options messages. We then use this field to populate the 388 * extensions when we build a descriptor, at which point all protos have been 389 * parsed and so all extensions are known. 390 * 391 * Extension numbers for custom options may be chosen as follows: 392 * * For options which will only be used within a single application or 393 * organization, or for experimental options, use field numbers 50000 394 * through 99999. It is up to you to ensure that you do not use the 395 * same number for multiple options. 396 * * For options which will be published and used publicly by multiple 397 * independent entities, e-mail protobuf-global-extension-registry@google.com 398 * to reserve extension numbers. Simply provide your project name (e.g. 399 * Objective-C plugin) and your project website (if available) -- there's no 400 * need to explain how you intend to use them. Usually you only need one 401 * extension number. You can declare multiple options with only one extension 402 * number by putting them in a sub-message. See the Custom Options section of 403 * the docs for examples: 404 * https://developers.google.com/protocol-buffers/docs/proto#options 405 * If this turns out to be popular, a web service will be set up 406 * to automatically assign option numbers. 407 */ 408 409 message FileOptions { 410 /* 411 * Sets the Java package where classes generated from this .proto will be 412 * placed. By default, the proto package is used, but this is often 413 * inappropriate because proto packages do not normally start with backwards 414 * domain names. 415 */ 416 optional string java_package = 1; 417 418 /* 419 * If set, all the classes from the .proto file are wrapped in a single 420 * outer class with the given name. This applies to both Proto1 421 * (equivalent to the old "--one_java_file" option) and Proto2 (where 422 * a .proto always translates to a single class, but you may want to 423 * explicitly choose the class name). 424 */ 425 optional string java_outer_classname = 8; 426 427 /* 428 * If set true, then the Java code generator will generate a separate .java 429 * file for each top-level message, enum, and service defined in the .proto 430 * file. Thus, these types will *not* be nested inside the outer class 431 * named by java_outer_classname. However, the outer class will still be 432 * generated to contain the file's getDescriptor() method as well as any 433 * top-level extensions defined in the file. 434 */ 435 optional bool java_multiple_files = 10 [default = false]; 436 437 /* This option does nothing. */ 438 optional bool java_generate_equals_and_hash = 20 [deprecated = true]; 439 440 /* 441 * If set true, then the Java2 code generator will generate code that 442 * throws an exception whenever an attempt is made to assign a non-UTF-8 443 * byte sequence to a string field. 444 * Message reflection will do the same. 445 * However, an extension field still accepts non-UTF-8 byte sequences. 446 * This option has no effect on when used with the lite runtime. 447 */ 448 optional bool java_string_check_utf8 = 27 [default = false]; 449 450 /* Generated classes can be optimized for speed or code size. */ 451 enum OptimizeMode { 452 SPEED = 1; /* Generate complete code for parsing, serialization, */ 453 454 /* etc. */ 455 CODE_SIZE = 2; /* Use ReflectionOps to implement these methods. */ 456 457 LITE_RUNTIME = 3; /* Generate code using MessageLite and the lite runtime. */ 458 } 459 460 optional OptimizeMode optimize_for = 9 [default = SPEED]; 461 462 /* 463 * Sets the Go package where structs generated from this .proto will be 464 * placed. If omitted, the Go package will be derived from the following: 465 * - The basename of the package import path, if provided. 466 * - Otherwise, the package statement in the .proto file, if present. 467 * - Otherwise, the basename of the .proto file, without extension. 468 */ 469 optional string go_package = 11; 470 471 /* 472 * Should generic services be generated in each language? "Generic" services 473 * are not specific to any particular RPC system. They are generated by the 474 * main code generators in each language (without additional plugins). 475 * Generic services were the only kind of service generation supported by 476 * early versions of google.protobuf. 477 * 478 * Generic services are now considered deprecated in favor of using plugins 479 * that generate code specific to your particular RPC system. Therefore, 480 * these default to false. Old code which depends on generic services should 481 * explicitly set them to true. 482 */ 483 optional bool cc_generic_services = 16 [default = false]; 484 485 optional bool java_generic_services = 17 [default = false]; 486 487 optional bool py_generic_services = 18 [default = false]; 488 489 optional bool php_generic_services = 42 [default = false]; 490 491 /* 492 * Is this file deprecated? 493 * Depending on the target platform, this can emit Deprecated annotations 494 * for everything in the file, or it will be completely ignored; in the very 495 * least, this is a formalization for deprecating files. 496 */ 497 optional bool deprecated = 23 [default = false]; 498 499 /* 500 * Enables the use of arenas for the proto messages in this file. This applies 501 * only to generated classes for C++. 502 */ 503 optional bool cc_enable_arenas = 31 [default = false]; 504 505 /* 506 * Sets the objective c class prefix which is prepended to all objective c 507 * generated classes from this .proto. There is no default. 508 */ 509 optional string objc_class_prefix = 36; 510 511 /* Namespace for generated classes; defaults to the package. */ 512 optional string csharp_namespace = 37; 513 514 /* 515 * By default Swift generators will take the proto package and CamelCase it 516 * replacing '.' with underscore and use that to prefix the types/symbols 517 * defined. When this options is provided, they will use this value instead 518 * to prefix the types/symbols defined. 519 */ 520 optional string swift_prefix = 39; 521 522 /* 523 * Sets the php class prefix which is prepended to all php generated classes 524 * from this .proto. Default is empty. 525 */ 526 optional string php_class_prefix = 40; 527 528 /* 529 * Use this option to change the namespace of php generated classes. Default 530 * is empty. When this option is empty, the package name will be used for 531 * determining the namespace. 532 */ 533 optional string php_namespace = 41; 534 535 /* 536 * Use this option to change the namespace of php generated metadata classes. 537 * Default is empty. When this option is empty, the proto file name will be 538 * used for determining the namespace. 539 */ 540 optional string php_metadata_namespace = 44; 541 542 /* 543 * Use this option to change the package of ruby generated classes. Default 544 * is empty. When this option is not set, the package name will be used for 545 * determining the ruby package. 546 */ 547 optional string ruby_package = 45; 548 549 /* 550 * The parser stores options it doesn't recognize here. 551 * See the documentation for the "Options" section above. 552 */ 553 repeated UninterpretedOption uninterpreted_option = 999; 554 555 extensions 1000 to max; 556 557 reserved 38; 558 } 559 560 message MessageOptions { 561 /* 562 * Set true to use the old proto1 MessageSet wire format for extensions. 563 * This is provided for backwards-compatibility with the MessageSet wire 564 * format. You should not use this for any other reason: It's less 565 * efficient, has fewer features, and is more complicated. 566 * 567 * The message must be defined exactly as follows: 568 * message Foo { 569 * option message_set_wire_format = true; 570 * extensions 4 to max; 571 * } 572 * Note that the message cannot have any defined fields; MessageSets only 573 * have extensions. 574 * 575 * All extensions of your type must be singular messages; e.g. they cannot 576 * be int32s, enums, or repeated messages. 577 * 578 * Because this is an option, the above two restrictions are not enforced by 579 * the protocol compiler. 580 */ 581 optional bool message_set_wire_format = 1 [default = false]; 582 583 /* 584 * Disables the generation of the standard "descriptor()" accessor, which can 585 * conflict with a field of the same name. This is meant to make migration 586 * from proto1 easier; new code should avoid fields named "descriptor". 587 */ 588 optional bool no_standard_descriptor_accessor = 2 [default = false]; 589 590 /* 591 * Is this message deprecated? 592 * Depending on the target platform, this can emit Deprecated annotations 593 * for the message, or it will be completely ignored; in the very least, 594 * this is a formalization for deprecating messages. 595 */ 596 optional bool deprecated = 3 [default = false]; 597 598 /* 599 * Whether the message is an automatically generated map entry type for the 600 * maps field. 601 * 602 * For maps fields: 603 * map<KeyType, ValueType> map_field = 1; 604 * The parsed descriptor looks like: 605 * message MapFieldEntry { 606 * option map_entry = true; 607 * optional KeyType key = 1; 608 * optional ValueType value = 2; 609 * } 610 * repeated MapFieldEntry map_field = 1; 611 * 612 * Implementations may choose not to generate the map_entry=true message, but 613 * use a native map in the target language to hold the keys and values. 614 * The reflection APIs in such implementations still need to work as 615 * if the field is a repeated message field. 616 * 617 * NOTE: Do not set the option in .proto files. Always use the maps syntax 618 * instead. The option should only be implicitly set by the proto compiler 619 * parser. 620 */ 621 optional bool map_entry = 7; 622 623 reserved 8, 9; 624 625 /* The parser stores options it doesn't recognize here. See above. */ 626 repeated UninterpretedOption uninterpreted_option = 999; 627 628 extensions 1000 to max; 629 } 630 631 message FieldOptions { 632 /* 633 * The ctype option instructs the C++ code generator to use a different 634 * representation of the field than it normally would. See the specific 635 * options below. This option is not yet implemented in the open source 636 * release -- sorry, we'll try to include it in a future version! 637 */ 638 optional CType ctype = 1 [default = STRING]; 639 640 enum CType { 641 /* Default mode. */ 642 STRING = 0; 643 644 CORD = 1; 645 646 STRING_PIECE = 2; 647 } 648 649 /* 650 * The packed option can be enabled for repeated primitive fields to enable 651 * a more efficient representation on the wire. Rather than repeatedly 652 * writing the tag and type for each element, the entire array is encoded as 653 * a single length-delimited blob. In proto3, only explicit setting it to 654 * false will avoid using packed encoding. 655 */ 656 optional bool packed = 2; 657 658 /* 659 * The jstype option determines the JavaScript type used for values of the 660 * field. The option is permitted only for 64 bit integral and fixed types 661 * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING 662 * is represented as JavaScript string, which avoids loss of precision that 663 * can happen when a large value is converted to a floating point JavaScript. 664 * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to 665 * use the JavaScript "number" type. The behavior of the default option 666 * JS_NORMAL is implementation dependent. 667 * 668 * This option is an enum to permit additional types to be added, e.g. 669 * goog.math.Integer. 670 */ 671 optional JSType jstype = 6 [default = JS_NORMAL]; 672 673 enum JSType { 674 /* Use the default type. */ 675 JS_NORMAL = 0; 676 677 /* Use JavaScript strings. */ 678 JS_STRING = 1; 679 680 /* Use JavaScript numbers. */ 681 JS_NUMBER = 2; 682 } 683 684 /* 685 * Should this field be parsed lazily? Lazy applies only to message-type 686 * fields. It means that when the outer message is initially parsed, the 687 * inner message's contents will not be parsed but instead stored in encoded 688 * form. The inner message will actually be parsed when it is first accessed. 689 * 690 * This is only a hint. Implementations are free to choose whether to use 691 * eager or lazy parsing regardless of the value of this option. However, 692 * setting this option true suggests that the protocol author believes that 693 * using lazy parsing on this field is worth the additional bookkeeping 694 * overhead typically needed to implement it. 695 * 696 * This option does not affect the public interface of any generated code; 697 * all method signatures remain the same. Furthermore, thread-safety of the 698 * interface is not affected by this option; const methods remain safe to 699 * call from multiple threads concurrently, while non-const methods continue 700 * to require exclusive access. 701 * 702 * 703 * Note that implementations may choose not to check required fields within 704 * a lazy sub-message. That is, calling IsInitialized() on the outer message 705 * may return true even if the inner message has missing required fields. 706 * This is necessary because otherwise the inner message would have to be 707 * parsed in order to perform the check, defeating the purpose of lazy 708 * parsing. An implementation which chooses not to check required fields 709 * must be consistent about it. That is, for any particular sub-message, the 710 * implementation must either *always* check its required fields, or *never* 711 * check its required fields, regardless of whether or not the message has 712 * been parsed. 713 */ 714 optional bool lazy = 5 [default = false]; 715 716 /* 717 * Is this field deprecated? 718 * Depending on the target platform, this can emit Deprecated annotations 719 * for accessors, or it will be completely ignored; in the very least, this 720 * is a formalization for deprecating fields. 721 */ 722 optional bool deprecated = 3 [default = false]; 723 724 /* For Google-internal migration only. Do not use. */ 725 optional bool weak = 10 [default = false]; 726 727 /* The parser stores options it doesn't recognize here. See above. */ 728 repeated UninterpretedOption uninterpreted_option = 999; 729 730 extensions 1000 to max; 731 732 reserved 4; 733 } 734 735 message OneofOptions { 736 /* The parser stores options it doesn't recognize here. See above. */ 737 repeated UninterpretedOption uninterpreted_option = 999; 738 739 extensions 1000 to max; 740 } 741 742 message EnumOptions { 743 /* 744 * Set this option to true to allow mapping different tag names to the same 745 * value. 746 */ 747 optional bool allow_alias = 2; 748 749 /* 750 * Is this enum deprecated? 751 * Depending on the target platform, this can emit Deprecated annotations 752 * for the enum, or it will be completely ignored; in the very least, this 753 * is a formalization for deprecating enums. 754 */ 755 optional bool deprecated = 3 [default = false]; 756 757 reserved 5; 758 759 /* The parser stores options it doesn't recognize here. See above. */ 760 repeated UninterpretedOption uninterpreted_option = 999; 761 762 extensions 1000 to max; 763 } 764 765 message EnumValueOptions { 766 /* 767 * Is this enum value deprecated? 768 * Depending on the target platform, this can emit Deprecated annotations 769 * for the enum value, or it will be completely ignored; in the very least, 770 * this is a formalization for deprecating enum values. 771 */ 772 optional bool deprecated = 1 [default = false]; 773 774 /* The parser stores options it doesn't recognize here. See above. */ 775 repeated UninterpretedOption uninterpreted_option = 999; 776 777 extensions 1000 to max; 778 } 779 780 message ServiceOptions { 781 /* 782 * Note: Field numbers 1 through 32 are reserved for Google's internal RPC 783 * framework. We apologize for hoarding these numbers to ourselves, but 784 * we were already using them long before we decided to release Protocol 785 * Buffers. 786 */ 787 788 /* 789 * Is this service deprecated? 790 * Depending on the target platform, this can emit Deprecated annotations 791 * for the service, or it will be completely ignored; in the very least, 792 * this is a formalization for deprecating services. 793 */ 794 optional bool deprecated = 33 [default = false]; 795 796 /* The parser stores options it doesn't recognize here. See above. */ 797 repeated UninterpretedOption uninterpreted_option = 999; 798 799 extensions 1000 to max; 800 } 801 802 message MethodOptions { 803 /* 804 * Note: Field numbers 1 through 32 are reserved for Google's internal RPC 805 * framework. We apologize for hoarding these numbers to ourselves, but 806 * we were already using them long before we decided to release Protocol 807 * Buffers. 808 */ 809 810 /* 811 * Is this method deprecated? 812 * Depending on the target platform, this can emit Deprecated annotations 813 * for the method, or it will be completely ignored; in the very least, 814 * this is a formalization for deprecating methods. 815 */ 816 optional bool deprecated = 33 [default = false]; 817 818 /* 819 * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, 820 * or neither? HTTP based RPC implementation may choose GET verb for safe 821 * methods, and PUT verb for idempotent methods instead of the default POST. 822 */ 823 enum IdempotencyLevel { 824 IDEMPOTENCY_UNKNOWN = 0; 825 826 NO_SIDE_EFFECTS = 1; /* implies idempotent */ 827 828 IDEMPOTENT = 2; /* idempotent, but may have side effects */ 829 } 830 831 optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; 832 833 /* The parser stores options it doesn't recognize here. See above. */ 834 repeated UninterpretedOption uninterpreted_option = 999; 835 836 extensions 1000 to max; 837 } 838 839 /* 840 * A message representing a option the parser does not recognize. This only 841 * appears in options protos created by the compiler::Parser class. 842 * DescriptorPool resolves these when building Descriptor objects. Therefore, 843 * options protos in descriptor objects (e.g. returned by Descriptor::options(), 844 * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions 845 * in them. 846 */ 847 message UninterpretedOption { 848 /* 849 * The name of the uninterpreted option. Each string represents a segment in 850 * a dot-separated name. is_extension is true iff a segment represents an 851 * extension (denoted with parentheses in options specs in .proto files). 852 * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents 853 * "foo.(bar.baz).qux". 854 */ 855 message NamePart { 856 required string name_part = 1; 857 858 required bool is_extension = 2; 859 } 860 861 repeated NamePart name = 2; 862 863 /* 864 * The value of the uninterpreted option, in whatever type the tokenizer 865 * identified it as during parsing. Exactly one of these should be set. 866 */ 867 optional string identifier_value = 3; 868 869 optional uint64 positive_int_value = 4; 870 871 optional int64 negative_int_value = 5; 872 873 optional double double_value = 6; 874 875 optional bytes string_value = 7; 876 877 optional string aggregate_value = 8; 878 } 879 880 /* 881 * =================================================================== 882 * Optional source code info 883 */ 884 885 /* 886 * Encapsulates information about the original source file from which a 887 * FileDescriptorProto was generated. 888 */ 889 message SourceCodeInfo { 890 /* 891 * A Location identifies a piece of source code in a .proto file which 892 * corresponds to a particular definition. This information is intended 893 * to be useful to IDEs, code indexers, documentation generators, and similar 894 * tools. 895 * 896 * For example, say we have a file like: 897 * message Foo { 898 * optional string foo = 1; 899 * } 900 * Let's look at just the field definition: 901 * optional string foo = 1; 902 * ^ ^^ ^^ ^ ^^^ 903 * a bc de f ghi 904 * We have the following locations: 905 * span path represents 906 * [a,i) [ 4, 0, 2, 0 ] The whole field definition. 907 * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). 908 * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). 909 * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). 910 * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). 911 * 912 * Notes: 913 * - A location may refer to a repeated field itself (i.e. not to any 914 * particular index within it). This is used whenever a set of elements are 915 * logically enclosed in a single code segment. For example, an entire 916 * extend block (possibly containing multiple extension definitions) will 917 * have an outer location whose path refers to the "extensions" repeated 918 * field without an index. 919 * - Multiple locations may have the same path. This happens when a single 920 * logical declaration is spread out across multiple places. The most 921 * obvious example is the "extend" block again -- there may be multiple 922 * extend blocks in the same scope, each of which will have the same path. 923 * - A location's span is not always a subset of its parent's span. For 924 * example, the "extendee" of an extension declaration appears at the 925 * beginning of the "extend" block and is shared by all extensions within 926 * the block. 927 * - Just because a location's span is a subset of some other location's span 928 * does not mean that it is a descendant. For example, a "group" defines 929 * both a type and a field in a single declaration. Thus, the locations 930 * corresponding to the type and field and their components will overlap. 931 * - Code which tries to interpret locations should probably be designed to 932 * ignore those that it doesn't understand, as more types of locations could 933 * be recorded in the future. 934 */ 935 repeated Location location = 1; 936 937 message Location { 938 /* 939 * Identifies which part of the FileDescriptorProto was defined at this 940 * location. 941 * 942 * Each element is a field number or an index. They form a path from 943 * the root FileDescriptorProto to the place where the definition. For 944 * example, this path: 945 * [ 4, 3, 2, 7, 1 ] 946 * refers to: 947 * file.message_type(3) // 4, 3 948 * .field(7) // 2, 7 949 * .name() // 1 950 * This is because FileDescriptorProto.message_type has field number 4: 951 * repeated DescriptorProto message_type = 4; 952 * and DescriptorProto.field has field number 2: 953 * repeated FieldDescriptorProto field = 2; 954 * and FieldDescriptorProto.name has field number 1: 955 * optional string name = 1; 956 * 957 * Thus, the above path gives the location of a field name. If we removed 958 * the last element: 959 * [ 4, 3, 2, 7 ] 960 * this path refers to the whole field declaration (from the beginning 961 * of the label to the terminating semicolon). 962 */ 963 repeated int32 path = 1 [packed = true]; 964 965 /* 966 * Always has exactly three or four elements: start line, start column, 967 * end line (optional, otherwise assumed same as start line), end column. 968 * These are packed into a single field for efficiency. Note that line 969 * and column numbers are zero-based -- typically you will want to add 970 * 1 to each before displaying to a user. 971 */ 972 repeated int32 span = 2 [packed = true]; 973 974 // If this SourceCodeInfo represents a complete declaration, these are any 975 // comments appearing before and after the declaration which appear to be 976 // attached to the declaration. 977 // 978 // A series of line comments appearing on consecutive lines, with no other 979 // tokens appearing on those lines, will be treated as a single comment. 980 // 981 // leading_detached_comments will keep paragraphs of comments that appear 982 // before (but not connected to) the current element. Each paragraph, 983 // separated by empty lines, will be one comment element in the repeated 984 // field. 985 // 986 // Only the comment content is provided; comment markers (e.g. //) are 987 // stripped out. For block comments, leading whitespace and an asterisk 988 // will be stripped from the beginning of each line other than the first. 989 // Newlines are included in the output. 990 // 991 // Examples: 992 // 993 // optional int32 foo = 1; // Comment attached to foo. 994 // // Comment attached to bar. 995 // optional int32 bar = 2; 996 // 997 // optional string baz = 3; 998 // // Comment attached to baz. 999 // // Another line attached to baz. 1000 // 1001 // // Comment attached to qux. 1002 // // 1003 // // Another line attached to qux. 1004 // optional double qux = 4; 1005 // 1006 // // Detached comment for corge. This is not leading or trailing comments 1007 // // to qux or corge because there are blank lines separating it from 1008 // // both. 1009 // 1010 // // Detached comment for corge paragraph 2. 1011 // 1012 // optional string corge = 5; 1013 // /* Block comment attached 1014 // * to corge. Leading asterisks 1015 // * will be removed. */ 1016 // /* Block comment attached to 1017 // * grault. */ 1018 // optional int32 grault = 6; 1019 // 1020 // // ignored detached comments. 1021 optional string leading_comments = 3; 1022 1023 optional string trailing_comments = 4; 1024 1025 repeated string leading_detached_comments = 6; 1026 } 1027 } 1028 1029 /* 1030 * Describes the relationship between generated code and its original source 1031 * file. A GeneratedCodeInfo message is associated with only one generated 1032 * source file, but may contain references to different source .proto files. 1033 */ 1034 message GeneratedCodeInfo { 1035 /* 1036 * An Annotation connects some span of text in generated code to an element 1037 * of its generating .proto file. 1038 */ 1039 repeated Annotation annotation = 1; 1040 1041 message Annotation { 1042 /* 1043 * Identifies the element in the original source .proto file. This field 1044 * is formatted the same as SourceCodeInfo.Location.path. 1045 */ 1046 repeated int32 path = 1 [packed = true]; 1047 1048 /* Identifies the filesystem path to the original source .proto. */ 1049 optional string source_file = 2; 1050 1051 /* 1052 * Identifies the starting offset in bytes in the generated code 1053 * that relates to the identified object. 1054 */ 1055 optional int32 begin = 3; 1056 1057 /* 1058 * Identifies the ending offset in bytes in the generated code that 1059 * relates to the identified offset. The end offset should be one past 1060 * the last relevant byte (so the length of the text = end - begin). 1061 */ 1062 optional int32 end = 4; 1063 } 1064 }