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