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