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