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