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