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