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