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