Khen Nursimulu | aaac7ee | 2016-12-11 22:03:52 -0500 | [diff] [blame] | 1 | |
| 2 | module ietf-descriptor { |
| 3 | |
| 4 | |
| 5 | namespace "urn:opencord:params:xml:ns:voltha:ietf-descriptor"; |
| 6 | prefix descriptor; |
| 7 | |
| 8 | |
| 9 | organization "CORD"; |
| 10 | contact |
| 11 | " Any name"; |
| 12 | |
| 13 | description |
| 14 | ""; |
| 15 | |
| 16 | revision "2016-11-15" { |
| 17 | description "Initial revision."; |
| 18 | reference "reference"; |
| 19 | } |
| 20 | |
| 21 | |
| 22 | container FileDescriptorSet { |
| 23 | description |
| 24 | "The protocol compiler can output a FileDescriptorSet containing the .proto |
| 25 | files it parses."; |
| 26 | list file { |
| 27 | key "name"; |
| 28 | uses FileDescriptorProto; |
| 29 | |
| 30 | description |
| 31 | ""; |
| 32 | } |
| 33 | |
| 34 | } |
| 35 | |
| 36 | grouping FileDescriptorProto { |
| 37 | description |
| 38 | "Describes a complete .proto file."; |
| 39 | leaf name { |
| 40 | type string; |
| 41 | description |
| 42 | "file name, relative to root of source tree"; |
| 43 | } |
| 44 | |
| 45 | leaf package { |
| 46 | type string; |
| 47 | description |
| 48 | "e.g. foo , foo.bar , etc."; |
| 49 | } |
| 50 | |
| 51 | list dependency { |
| 52 | key "dependency"; |
| 53 | leaf dependency { |
| 54 | type string; |
| 55 | description |
| 56 | "Names of files imported by this file."; |
| 57 | } |
| 58 | description |
| 59 | "Names of files imported by this file."; |
| 60 | } |
| 61 | |
| 62 | list public_dependency { |
| 63 | key "public_dependency"; |
| 64 | leaf public_dependency { |
| 65 | type int32; |
| 66 | description |
| 67 | "Indexes of the public imported files in the dependency list above."; |
| 68 | } |
| 69 | description |
| 70 | "Indexes of the public imported files in the dependency list above."; |
| 71 | } |
| 72 | |
| 73 | list weak_dependency { |
| 74 | key "weak_dependency"; |
| 75 | leaf weak_dependency { |
| 76 | type int32; |
| 77 | description |
| 78 | "Indexes of the weak imported files in the dependency list. |
| 79 | For Google-internal migration only. Do not use."; |
| 80 | } |
| 81 | description |
| 82 | "Indexes of the weak imported files in the dependency list. |
| 83 | For Google-internal migration only. Do not use."; |
| 84 | } |
| 85 | |
| 86 | list message_type { |
| 87 | key "name"; |
| 88 | uses DescriptorProto; |
| 89 | |
| 90 | description |
| 91 | "All top-level definitions in this file."; |
| 92 | } |
| 93 | |
| 94 | list enum_type { |
| 95 | key "name"; |
| 96 | uses EnumDescriptorProto; |
| 97 | |
| 98 | description |
| 99 | ""; |
| 100 | } |
| 101 | |
| 102 | list service { |
| 103 | key "name"; |
| 104 | uses ServiceDescriptorProto; |
| 105 | |
| 106 | description |
| 107 | ""; |
| 108 | } |
| 109 | |
| 110 | list extension { |
| 111 | key "name"; |
| 112 | uses FieldDescriptorProto; |
| 113 | |
| 114 | description |
| 115 | ""; |
| 116 | } |
| 117 | |
| 118 | container options { |
| 119 | uses FileOptions; |
| 120 | |
| 121 | description |
| 122 | ""; |
| 123 | } |
| 124 | |
| 125 | container source_code_info { |
| 126 | uses SourceCodeInfo; |
| 127 | |
| 128 | description |
| 129 | "This field contains optional information about the original source code. |
| 130 | You may safely remove this entire field without harming runtime |
| 131 | functionality of the descriptors -- the information is needed only by |
| 132 | development tools."; |
| 133 | } |
| 134 | |
| 135 | leaf syntax { |
| 136 | type string; |
| 137 | description |
| 138 | "The syntax of the proto file. |
| 139 | The supported values are proto2 and proto3 ."; |
| 140 | } |
| 141 | |
| 142 | } |
| 143 | |
| 144 | grouping DescriptorProto { |
| 145 | description |
| 146 | "Describes a message type."; |
| 147 | leaf name { |
| 148 | type string; |
| 149 | description |
| 150 | ""; |
| 151 | } |
| 152 | |
| 153 | list field { |
| 154 | key "name"; |
| 155 | uses FieldDescriptorProto; |
| 156 | |
| 157 | description |
| 158 | ""; |
| 159 | } |
| 160 | |
| 161 | list extension { |
| 162 | key "name"; |
| 163 | uses FieldDescriptorProto; |
| 164 | |
| 165 | description |
| 166 | ""; |
| 167 | } |
| 168 | |
| 169 | list nested_type { |
| 170 | key "name"; |
| 171 | uses DescriptorProto; |
| 172 | |
| 173 | description |
| 174 | ""; |
| 175 | } |
| 176 | |
| 177 | list enum_type { |
| 178 | key "name"; |
| 179 | uses EnumDescriptorProto; |
| 180 | |
| 181 | description |
| 182 | ""; |
| 183 | } |
| 184 | |
| 185 | |
| 186 | list oneof_decl { |
| 187 | key "name"; |
| 188 | uses OneofDescriptorProto; |
| 189 | |
| 190 | description |
| 191 | ""; |
| 192 | } |
| 193 | |
| 194 | container options { |
| 195 | uses MessageOptions; |
| 196 | |
| 197 | description |
| 198 | ""; |
| 199 | } |
| 200 | |
| 201 | |
| 202 | list reserved_name { |
| 203 | key "reserved_name"; |
| 204 | leaf reserved_name { |
| 205 | type string; |
| 206 | description |
| 207 | "Reserved field names, which may not be used by fields in the same message. |
| 208 | A given name may only be reserved once."; |
| 209 | } |
| 210 | description |
| 211 | "Reserved field names, which may not be used by fields in the same message. |
| 212 | A given name may only be reserved once."; |
| 213 | } |
| 214 | |
| 215 | grouping ExtensionRange { |
| 216 | description |
| 217 | ""; |
| 218 | leaf start { |
| 219 | type int32; |
| 220 | description |
| 221 | ""; |
| 222 | } |
| 223 | |
| 224 | leaf end { |
| 225 | type int32; |
| 226 | description |
| 227 | ""; |
| 228 | } |
| 229 | |
| 230 | } |
| 231 | |
| 232 | grouping ReservedRange { |
| 233 | description |
| 234 | "Range of reserved tag numbers. Reserved tag numbers may not be used by |
| 235 | fields or extension ranges in the same message. Reserved ranges may |
| 236 | not overlap."; |
| 237 | leaf start { |
| 238 | type int32; |
| 239 | description |
| 240 | "Inclusive."; |
| 241 | } |
| 242 | |
| 243 | leaf end { |
| 244 | type int32; |
| 245 | description |
| 246 | "Exclusive."; |
| 247 | } |
| 248 | |
| 249 | } |
| 250 | |
| 251 | } |
| 252 | |
| 253 | grouping FieldDescriptorProto { |
| 254 | description |
| 255 | "Describes a field within a message."; |
| 256 | leaf name { |
| 257 | type string; |
| 258 | description |
| 259 | ""; |
| 260 | } |
| 261 | |
| 262 | leaf number { |
| 263 | type int32; |
| 264 | description |
| 265 | ""; |
| 266 | } |
| 267 | |
| 268 | leaf label { |
| 269 | type Label; |
| 270 | description |
| 271 | ""; |
| 272 | } |
| 273 | |
| 274 | leaf type { |
| 275 | type Type; |
| 276 | description |
| 277 | "If type_name is set, this need not be set. If both this and type_name |
| 278 | are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP."; |
| 279 | } |
| 280 | |
| 281 | leaf type_name { |
| 282 | type string; |
| 283 | description |
| 284 | "For message and enum types, this is the name of the type. If the name |
| 285 | starts with a '.', it is fully-qualified. Otherwise, C++-like scoping |
| 286 | rules are used to find the type (i.e. first the nested types within this |
| 287 | message are searched, then within the parent, on up to the root |
| 288 | namespace)."; |
| 289 | } |
| 290 | |
| 291 | leaf extendee { |
| 292 | type string; |
| 293 | description |
| 294 | "For extensions, this is the name of the type being extended. It is |
| 295 | resolved in the same manner as type_name."; |
| 296 | } |
| 297 | |
| 298 | leaf default_value { |
| 299 | type string; |
| 300 | description |
| 301 | "For numeric types, contains the original text representation of the value. |
| 302 | For booleans, true or false . |
| 303 | For strings, contains the default text contents (not escaped in any way). |
| 304 | For bytes, contains the C escaped value. All bytes >= 128 are escaped. |
| 305 | TODO(kenton): Base-64 encode?"; |
| 306 | } |
| 307 | |
| 308 | leaf oneof_index { |
| 309 | type int32; |
| 310 | description |
| 311 | "If set, gives the index of a oneof in the containing type's oneof_decl |
| 312 | list. This field is a member of that oneof."; |
| 313 | } |
| 314 | |
| 315 | leaf json_name { |
| 316 | type string; |
| 317 | description |
| 318 | "JSON name of this field. The value is set by protocol compiler. If the |
| 319 | user has set a json_name option on this field, that option's value |
| 320 | will be used. Otherwise, it's deduced from the field's name by converting |
| 321 | it to camelCase."; |
| 322 | } |
| 323 | |
| 324 | container options { |
| 325 | uses FieldOptions; |
| 326 | |
| 327 | description |
| 328 | ""; |
| 329 | } |
| 330 | |
| 331 | typedef Type { |
| 332 | type enumeration { |
| 333 | enum TYPE_DOUBLE { |
| 334 | description ""; |
| 335 | } |
| 336 | enum TYPE_FLOAT { |
| 337 | description ""; |
| 338 | } |
| 339 | enum TYPE_INT64 { |
| 340 | description ""; |
| 341 | } |
| 342 | enum TYPE_UINT64 { |
| 343 | description ""; |
| 344 | } |
| 345 | enum TYPE_INT32 { |
| 346 | description ""; |
| 347 | } |
| 348 | enum TYPE_FIXED64 { |
| 349 | description ""; |
| 350 | } |
| 351 | enum TYPE_FIXED32 { |
| 352 | description ""; |
| 353 | } |
| 354 | enum TYPE_BOOL { |
| 355 | description ""; |
| 356 | } |
| 357 | enum TYPE_STRING { |
| 358 | description ""; |
| 359 | } |
| 360 | enum TYPE_GROUP { |
| 361 | description ""; |
| 362 | } |
| 363 | enum TYPE_MESSAGE { |
| 364 | description ""; |
| 365 | } |
| 366 | enum TYPE_BYTES { |
| 367 | description ""; |
| 368 | } |
| 369 | enum TYPE_UINT32 { |
| 370 | description ""; |
| 371 | } |
| 372 | enum TYPE_ENUM { |
| 373 | description ""; |
| 374 | } |
| 375 | enum TYPE_SFIXED32 { |
| 376 | description ""; |
| 377 | } |
| 378 | enum TYPE_SFIXED64 { |
| 379 | description ""; |
| 380 | } |
| 381 | enum TYPE_SINT32 { |
| 382 | description ""; |
| 383 | } |
| 384 | enum TYPE_SINT64 { |
| 385 | description ""; |
| 386 | } |
| 387 | } |
| 388 | description |
| 389 | ""; |
| 390 | } |
| 391 | |
| 392 | typedef Label { |
| 393 | type enumeration { |
| 394 | enum LABEL_OPTIONAL { |
| 395 | description ""; |
| 396 | } |
| 397 | enum LABEL_REQUIRED { |
| 398 | description ""; |
| 399 | } |
| 400 | enum LABEL_REPEATED { |
| 401 | description ""; |
| 402 | } |
| 403 | } |
| 404 | description |
| 405 | ""; |
| 406 | } |
| 407 | |
| 408 | } |
| 409 | |
| 410 | grouping OneofDescriptorProto { |
| 411 | description |
| 412 | "Describes a oneof."; |
| 413 | leaf name { |
| 414 | type string; |
| 415 | description |
| 416 | ""; |
| 417 | } |
| 418 | |
| 419 | container options { |
| 420 | uses OneofOptions; |
| 421 | |
| 422 | description |
| 423 | ""; |
| 424 | } |
| 425 | |
| 426 | } |
| 427 | |
| 428 | grouping EnumDescriptorProto { |
| 429 | description |
| 430 | "Describes an enum type."; |
| 431 | leaf name { |
| 432 | type string; |
| 433 | description |
| 434 | ""; |
| 435 | } |
| 436 | |
| 437 | list value { |
| 438 | key "name"; |
| 439 | uses EnumValueDescriptorProto; |
| 440 | |
| 441 | description |
| 442 | ""; |
| 443 | } |
| 444 | |
| 445 | container options { |
| 446 | uses EnumOptions; |
| 447 | |
| 448 | description |
| 449 | ""; |
| 450 | } |
| 451 | |
| 452 | } |
| 453 | |
| 454 | grouping EnumValueDescriptorProto { |
| 455 | description |
| 456 | "Describes a value within an enum."; |
| 457 | leaf name { |
| 458 | type string; |
| 459 | description |
| 460 | ""; |
| 461 | } |
| 462 | |
| 463 | leaf number { |
| 464 | type int32; |
| 465 | description |
| 466 | ""; |
| 467 | } |
| 468 | |
| 469 | container options { |
| 470 | uses EnumValueOptions; |
| 471 | |
| 472 | description |
| 473 | ""; |
| 474 | } |
| 475 | |
| 476 | } |
| 477 | |
| 478 | grouping ServiceDescriptorProto { |
| 479 | description |
| 480 | "Describes a service."; |
| 481 | leaf name { |
| 482 | type string; |
| 483 | description |
| 484 | ""; |
| 485 | } |
| 486 | |
| 487 | list method { |
| 488 | key "name"; |
| 489 | uses MethodDescriptorProto; |
| 490 | |
| 491 | description |
| 492 | ""; |
| 493 | } |
| 494 | |
| 495 | container options { |
| 496 | uses ServiceOptions; |
| 497 | |
| 498 | description |
| 499 | ""; |
| 500 | } |
| 501 | |
| 502 | } |
| 503 | |
| 504 | grouping MethodDescriptorProto { |
| 505 | description |
| 506 | "Describes a method of a service."; |
| 507 | leaf name { |
| 508 | type string; |
| 509 | description |
| 510 | ""; |
| 511 | } |
| 512 | |
| 513 | leaf input_type { |
| 514 | type string; |
| 515 | description |
| 516 | "Input and output type names. These are resolved in the same way as |
| 517 | FieldDescriptorProto.type_name, but must refer to a message type."; |
| 518 | } |
| 519 | |
| 520 | leaf output_type { |
| 521 | type string; |
| 522 | description |
| 523 | ""; |
| 524 | } |
| 525 | |
| 526 | container options { |
| 527 | uses MethodOptions; |
| 528 | |
| 529 | description |
| 530 | ""; |
| 531 | } |
| 532 | |
| 533 | leaf client_streaming { |
| 534 | type boolean; |
| 535 | description |
| 536 | "Identifies if client streams multiple client messages"; |
| 537 | } |
| 538 | |
| 539 | leaf server_streaming { |
| 540 | type boolean; |
| 541 | description |
| 542 | "Identifies if server streams multiple server messages"; |
| 543 | } |
| 544 | |
| 545 | } |
| 546 | |
| 547 | grouping FileOptions { |
| 548 | description |
| 549 | "=================================================================== |
| 550 | Options |
| 551 | Each of the definitions above may have options attached. These are |
| 552 | just annotations which may cause code to be generated slightly differently |
| 553 | or may contain hints for code that manipulates protocol messages. |
| 554 | |
| 555 | Clients may define custom options as extensions of the Options messages. |
| 556 | These extensions may not yet be known at parsing time, so the parser cannot |
| 557 | store the values in them. Instead it stores them in a field in the Options |
| 558 | message called uninterpreted_option. This field must have the same name |
| 559 | across all Options messages. We then use this field to populate the |
| 560 | extensions when we build a descriptor, at which point all protos have been |
| 561 | parsed and so all extensions are known. |
| 562 | |
| 563 | Extension numbers for custom options may be chosen as follows: |
| 564 | For options which will only be used within a single application or |
| 565 | organization, or for experimental options, use field numbers 50000 |
| 566 | through 99999. It is up to you to ensure that you do not use the |
| 567 | same number for multiple options. |
| 568 | For options which will be published and used publicly by multiple |
| 569 | independent entities, e-mail protobuf-global-extension-registry@google.com |
| 570 | to reserve extension numbers. Simply provide your project name (e.g. |
| 571 | Objective-C plugin) and your project website (if available) -- there's no |
| 572 | need to explain how you intend to use them. Usually you only need one |
| 573 | extension number. You can declare multiple options with only one extension |
| 574 | number by putting them in a sub-message. See the Custom Options section of |
| 575 | the docs for examples: |
| 576 | https: developers.google.com protocol-buffers docs proto#options |
| 577 | If this turns out to be popular, a web service will be set up |
| 578 | to automatically assign option numbers."; |
| 579 | leaf java_package { |
| 580 | type string; |
| 581 | description |
| 582 | "Sets the Java package where classes generated from this .proto will be |
| 583 | placed. By default, the proto package is used, but this is often |
| 584 | inappropriate because proto packages do not normally start with backwards |
| 585 | domain names."; |
| 586 | } |
| 587 | |
| 588 | leaf java_outer_classname { |
| 589 | type string; |
| 590 | description |
| 591 | "If set, all the classes from the .proto file are wrapped in a single |
| 592 | outer class with the given name. This applies to both Proto1 |
| 593 | (equivalent to the old --one_java_file option) and Proto2 (where |
| 594 | a .proto always translates to a single class, but you may want to |
| 595 | explicitly choose the class name)."; |
| 596 | } |
| 597 | |
| 598 | leaf java_multiple_files { |
| 599 | type boolean; |
| 600 | description |
| 601 | "If set true, then the Java code generator will generate a separate .java |
| 602 | file for each top-level message, enum, and service defined in the .proto |
| 603 | file. Thus, these types will not be nested inside the outer class |
| 604 | named by java_outer_classname. However, the outer class will still be |
| 605 | generated to contain the file's getDescriptor() method as well as any |
| 606 | top-level extensions defined in the file."; |
| 607 | } |
| 608 | |
| 609 | leaf java_generate_equals_and_hash { |
| 610 | type boolean; |
| 611 | description |
| 612 | "If set true, then the Java code generator will generate equals() and |
| 613 | hashCode() methods for all messages defined in the .proto file. |
| 614 | This increases generated code size, potentially substantially for large |
| 615 | protos, which may harm a memory-constrained application. |
| 616 | - In the full runtime this is a speed optimization, as the |
| 617 | AbstractMessage base class includes reflection-based implementations of |
| 618 | these methods. |
| 619 | - In the lite runtime, setting this option changes the semantics of |
| 620 | equals() and hashCode() to more closely match those of the full runtime; |
| 621 | the generated methods compute their results based on field values rather |
| 622 | than object identity. (Implementations should not assume that hashcodes |
| 623 | will be consistent across runtimes or versions of the protocol compiler.)"; |
| 624 | } |
| 625 | |
| 626 | leaf java_string_check_utf8 { |
| 627 | type boolean; |
| 628 | description |
| 629 | "If set true, then the Java2 code generator will generate code that |
| 630 | throws an exception whenever an attempt is made to assign a non-UTF-8 |
| 631 | byte sequence to a string field. |
| 632 | Message reflection will do the same. |
| 633 | However, an extension field still accepts non-UTF-8 byte sequences. |
| 634 | This option has no effect on when used with the lite runtime."; |
| 635 | } |
| 636 | |
| 637 | leaf optimize_for { |
| 638 | type OptimizeMode; |
| 639 | description |
| 640 | ""; |
| 641 | } |
| 642 | |
| 643 | leaf go_package { |
| 644 | type string; |
| 645 | description |
| 646 | "Sets the Go package where structs generated from this .proto will be |
| 647 | placed. If omitted, the Go package will be derived from the following: |
| 648 | - The basename of the package import path, if provided. |
| 649 | - Otherwise, the package statement in the .proto file, if present. |
| 650 | - Otherwise, the basename of the .proto file, without extension."; |
| 651 | } |
| 652 | |
| 653 | leaf cc_generic_services { |
| 654 | type boolean; |
| 655 | description |
| 656 | "Should generic services be generated in each language? Generic services |
| 657 | are not specific to any particular RPC system. They are generated by the |
| 658 | main code generators in each language (without additional plugins). |
| 659 | Generic services were the only kind of service generation supported by |
| 660 | early versions of google.protobuf. |
| 661 | |
| 662 | Generic services are now considered deprecated in favor of using plugins |
| 663 | that generate code specific to your particular RPC system. Therefore, |
| 664 | these default to false. Old code which depends on generic services should |
| 665 | explicitly set them to true."; |
| 666 | } |
| 667 | |
| 668 | leaf java_generic_services { |
| 669 | type boolean; |
| 670 | description |
| 671 | ""; |
| 672 | } |
| 673 | |
| 674 | leaf py_generic_services { |
| 675 | type boolean; |
| 676 | description |
| 677 | ""; |
| 678 | } |
| 679 | |
| 680 | leaf deprecated { |
| 681 | type boolean; |
| 682 | description |
| 683 | "Is this file deprecated? |
| 684 | Depending on the target platform, this can emit Deprecated annotations |
| 685 | for everything in the file, or it will be completely ignored; in the very |
| 686 | least, this is a formalization for deprecating files."; |
| 687 | } |
| 688 | |
| 689 | leaf cc_enable_arenas { |
| 690 | type boolean; |
| 691 | description |
| 692 | "Enables the use of arenas for the proto messages in this file. This applies |
| 693 | only to generated classes for C++."; |
| 694 | } |
| 695 | |
| 696 | leaf objc_class_prefix { |
| 697 | type string; |
| 698 | description |
| 699 | "Sets the objective c class prefix which is prepended to all objective c |
| 700 | generated classes from this .proto. There is no default."; |
| 701 | } |
| 702 | |
| 703 | leaf csharp_namespace { |
| 704 | type string; |
| 705 | description |
| 706 | "Namespace for generated classes; defaults to the package."; |
| 707 | } |
| 708 | |
| 709 | list uninterpreted_option { |
| 710 | key "identifier_value"; |
| 711 | uses UninterpretedOption; |
| 712 | |
| 713 | description |
| 714 | "The parser stores options it doesn't recognize here. See above."; |
| 715 | } |
| 716 | |
| 717 | typedef OptimizeMode { |
| 718 | type enumeration { |
| 719 | enum SPEED { |
| 720 | description ""; |
| 721 | } |
| 722 | enum CODE_SIZE { |
| 723 | description ""; |
| 724 | } |
| 725 | enum LITE_RUNTIME { |
| 726 | description ""; |
| 727 | } |
| 728 | } |
| 729 | description |
| 730 | "Generated classes can be optimized for speed or code size."; |
| 731 | } |
| 732 | |
| 733 | } |
| 734 | |
| 735 | grouping MessageOptions { |
| 736 | description |
| 737 | ""; |
| 738 | leaf message_set_wire_format { |
| 739 | type boolean; |
| 740 | description |
| 741 | "Set true to use the old proto1 MessageSet wire format for extensions. |
| 742 | This is provided for backwards-compatibility with the MessageSet wire |
| 743 | format. You should not use this for any other reason: It's less |
| 744 | efficient, has fewer features, and is more complicated. |
| 745 | |
| 746 | The message must be defined exactly as follows: |
| 747 | message Foo |
| 748 | option message_set_wire_format = true; |
| 749 | extensions 4 to max; |
| 750 | |
| 751 | Note that the message cannot have any defined fields; MessageSets only |
| 752 | have extensions. |
| 753 | |
| 754 | All extensions of your type must be singular messages; e.g. they cannot |
| 755 | be int32s, enums, or repeated messages. |
| 756 | |
| 757 | Because this is an option, the above two restrictions are not enforced by |
| 758 | the protocol compiler."; |
| 759 | } |
| 760 | |
| 761 | leaf no_standard_descriptor_accessor { |
| 762 | type boolean; |
| 763 | description |
| 764 | "Disables the generation of the standard descriptor() accessor, which can |
| 765 | conflict with a field of the same name. This is meant to make migration |
| 766 | from proto1 easier; new code should avoid fields named descriptor ."; |
| 767 | } |
| 768 | |
| 769 | leaf deprecated { |
| 770 | type boolean; |
| 771 | description |
| 772 | "Is this message deprecated? |
| 773 | Depending on the target platform, this can emit Deprecated annotations |
| 774 | for the message, or it will be completely ignored; in the very least, |
| 775 | this is a formalization for deprecating messages."; |
| 776 | } |
| 777 | |
| 778 | leaf map_entry { |
| 779 | type boolean; |
| 780 | description |
| 781 | "Whether the message is an automatically generated map entry type for the |
| 782 | maps field. |
| 783 | |
| 784 | For maps fields: |
| 785 | map<KeyType, ValueType> map_field = 1; |
| 786 | The parsed descriptor looks like: |
| 787 | message MapFieldEntry |
| 788 | option map_entry = true; |
| 789 | optional KeyType key = 1; |
| 790 | optional ValueType value = 2; |
| 791 | |
| 792 | repeated MapFieldEntry map_field = 1; |
| 793 | |
| 794 | Implementations may choose not to generate the map_entry=true message, but |
| 795 | use a native map in the target language to hold the keys and values. |
| 796 | The reflection APIs in such implementions still need to work as |
| 797 | if the field is a repeated message field. |
| 798 | |
| 799 | NOTE: Do not set the option in .proto files. Always use the maps syntax |
| 800 | instead. The option should only be implicitly set by the proto compiler |
| 801 | parser."; |
| 802 | } |
| 803 | |
| 804 | list uninterpreted_option { |
| 805 | key "identifier_value"; |
| 806 | uses UninterpretedOption; |
| 807 | |
| 808 | description |
| 809 | "The parser stores options it doesn't recognize here. See above."; |
| 810 | } |
| 811 | |
| 812 | } |
| 813 | |
| 814 | grouping FieldOptions { |
| 815 | description |
| 816 | ""; |
| 817 | leaf ctype { |
| 818 | type CType; |
| 819 | description |
| 820 | "The ctype option instructs the C++ code generator to use a different |
| 821 | representation of the field than it normally would. See the specific |
| 822 | options below. This option is not yet implemented in the open source |
| 823 | release -- sorry, we'll try to include it in a future version!"; |
| 824 | } |
| 825 | |
| 826 | leaf packed { |
| 827 | type boolean; |
| 828 | description |
| 829 | "The packed option can be enabled for repeated primitive fields to enable |
| 830 | a more efficient representation on the wire. Rather than repeatedly |
| 831 | writing the tag and type for each element, the entire array is encoded as |
| 832 | a single length-delimited blob. In proto3, only explicit setting it to |
| 833 | false will avoid using packed encoding."; |
| 834 | } |
| 835 | |
| 836 | leaf jstype { |
| 837 | type JSType; |
| 838 | description |
| 839 | "The jstype option determines the JavaScript type used for values of the |
| 840 | field. The option is permitted only for 64 bit integral and fixed types |
| 841 | (int64, uint64, sint64, fixed64, sfixed64). By default these types are |
| 842 | represented as JavaScript strings. This avoids loss of precision that can |
| 843 | happen when a large value is converted to a floating point JavaScript |
| 844 | numbers. Specifying JS_NUMBER for the jstype causes the generated |
| 845 | JavaScript code to use the JavaScript number type instead of strings. |
| 846 | This option is an enum to permit additional types to be added, |
| 847 | e.g. goog.math.Integer."; |
| 848 | } |
| 849 | |
| 850 | leaf lazy { |
| 851 | type boolean; |
| 852 | description |
| 853 | "Should this field be parsed lazily? Lazy applies only to message-type |
| 854 | fields. It means that when the outer message is initially parsed, the |
| 855 | inner message's contents will not be parsed but instead stored in encoded |
| 856 | form. The inner message will actually be parsed when it is first accessed. |
| 857 | |
| 858 | This is only a hint. Implementations are free to choose whether to use |
| 859 | eager or lazy parsing regardless of the value of this option. However, |
| 860 | setting this option true suggests that the protocol author believes that |
| 861 | using lazy parsing on this field is worth the additional bookkeeping |
| 862 | overhead typically needed to implement it. |
| 863 | |
| 864 | This option does not affect the public interface of any generated code; |
| 865 | all method signatures remain the same. Furthermore, thread-safety of the |
| 866 | interface is not affected by this option; const methods remain safe to |
| 867 | call from multiple threads concurrently, while non-const methods continue |
| 868 | to require exclusive access. |
| 869 | |
| 870 | |
| 871 | Note that implementations may choose not to check required fields within |
| 872 | a lazy sub-message. That is, calling IsInitialized() on the outher message |
| 873 | may return true even if the inner message has missing required fields. |
| 874 | This is necessary because otherwise the inner message would have to be |
| 875 | parsed in order to perform the check, defeating the purpose of lazy |
| 876 | parsing. An implementation which chooses not to check required fields |
| 877 | must be consistent about it. That is, for any particular sub-message, the |
| 878 | implementation must either always check its required fields, or never |
| 879 | check its required fields, regardless of whether or not the message has |
| 880 | been parsed."; |
| 881 | } |
| 882 | |
| 883 | leaf deprecated { |
| 884 | type boolean; |
| 885 | description |
| 886 | "Is this field deprecated? |
| 887 | Depending on the target platform, this can emit Deprecated annotations |
| 888 | for accessors, or it will be completely ignored; in the very least, this |
| 889 | is a formalization for deprecating fields."; |
| 890 | } |
| 891 | |
| 892 | leaf weak { |
| 893 | type boolean; |
| 894 | description |
| 895 | "For Google-internal migration only. Do not use."; |
| 896 | } |
| 897 | |
| 898 | list uninterpreted_option { |
| 899 | key "identifier_value"; |
| 900 | uses UninterpretedOption; |
| 901 | |
| 902 | description |
| 903 | "The parser stores options it doesn't recognize here. See above."; |
| 904 | } |
| 905 | |
| 906 | typedef CType { |
| 907 | type enumeration { |
| 908 | enum STRING { |
| 909 | description ""; |
| 910 | } |
| 911 | enum CORD { |
| 912 | description ""; |
| 913 | } |
| 914 | enum STRING_PIECE { |
| 915 | description ""; |
| 916 | } |
| 917 | } |
| 918 | description |
| 919 | ""; |
| 920 | } |
| 921 | |
| 922 | typedef JSType { |
| 923 | type enumeration { |
| 924 | enum JS_NORMAL { |
| 925 | description ""; |
| 926 | } |
| 927 | enum JS_STRING { |
| 928 | description ""; |
| 929 | } |
| 930 | enum JS_NUMBER { |
| 931 | description ""; |
| 932 | } |
| 933 | } |
| 934 | description |
| 935 | ""; |
| 936 | } |
| 937 | |
| 938 | } |
| 939 | |
| 940 | grouping OneofOptions { |
| 941 | description |
| 942 | ""; |
| 943 | list uninterpreted_option { |
| 944 | key "identifier_value"; |
| 945 | uses UninterpretedOption; |
| 946 | |
| 947 | description |
| 948 | "The parser stores options it doesn't recognize here. See above."; |
| 949 | } |
| 950 | |
| 951 | } |
| 952 | |
| 953 | grouping EnumOptions { |
| 954 | description |
| 955 | ""; |
| 956 | leaf allow_alias { |
| 957 | type boolean; |
| 958 | description |
| 959 | "Set this option to true to allow mapping different tag names to the same |
| 960 | value."; |
| 961 | } |
| 962 | |
| 963 | leaf deprecated { |
| 964 | type boolean; |
| 965 | description |
| 966 | "Is this enum deprecated? |
| 967 | Depending on the target platform, this can emit Deprecated annotations |
| 968 | for the enum, or it will be completely ignored; in the very least, this |
| 969 | is a formalization for deprecating enums."; |
| 970 | } |
| 971 | |
| 972 | list uninterpreted_option { |
| 973 | key "identifier_value"; |
| 974 | uses UninterpretedOption; |
| 975 | |
| 976 | description |
| 977 | "The parser stores options it doesn't recognize here. See above."; |
| 978 | } |
| 979 | |
| 980 | } |
| 981 | |
| 982 | grouping EnumValueOptions { |
| 983 | description |
| 984 | ""; |
| 985 | leaf deprecated { |
| 986 | type boolean; |
| 987 | description |
| 988 | "Is this enum value deprecated? |
| 989 | Depending on the target platform, this can emit Deprecated annotations |
| 990 | for the enum value, or it will be completely ignored; in the very least, |
| 991 | this is a formalization for deprecating enum values."; |
| 992 | } |
| 993 | |
| 994 | list uninterpreted_option { |
| 995 | key "identifier_value"; |
| 996 | uses UninterpretedOption; |
| 997 | |
| 998 | description |
| 999 | "The parser stores options it doesn't recognize here. See above."; |
| 1000 | } |
| 1001 | |
| 1002 | } |
| 1003 | |
| 1004 | grouping ServiceOptions { |
| 1005 | description |
| 1006 | ""; |
| 1007 | leaf deprecated { |
| 1008 | type boolean; |
| 1009 | description |
| 1010 | "Is this service deprecated? |
| 1011 | Depending on the target platform, this can emit Deprecated annotations |
| 1012 | for the service, or it will be completely ignored; in the very least, |
| 1013 | this is a formalization for deprecating services. |
| 1014 | Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
| 1015 | framework. We apologize for hoarding these numbers to ourselves, but |
| 1016 | we were already using them long before we decided to release Protocol |
| 1017 | Buffers."; |
| 1018 | } |
| 1019 | |
| 1020 | list uninterpreted_option { |
| 1021 | key "identifier_value"; |
| 1022 | uses UninterpretedOption; |
| 1023 | |
| 1024 | description |
| 1025 | "The parser stores options it doesn't recognize here. See above."; |
| 1026 | } |
| 1027 | |
| 1028 | } |
| 1029 | |
| 1030 | grouping MethodOptions { |
| 1031 | description |
| 1032 | ""; |
| 1033 | leaf deprecated { |
| 1034 | type boolean; |
| 1035 | description |
| 1036 | "Is this method deprecated? |
| 1037 | Depending on the target platform, this can emit Deprecated annotations |
| 1038 | for the method, or it will be completely ignored; in the very least, |
| 1039 | this is a formalization for deprecating methods. |
| 1040 | Note: Field numbers 1 through 32 are reserved for Google's internal RPC |
| 1041 | framework. We apologize for hoarding these numbers to ourselves, but |
| 1042 | we were already using them long before we decided to release Protocol |
| 1043 | Buffers."; |
| 1044 | } |
| 1045 | |
| 1046 | list uninterpreted_option { |
| 1047 | key "identifier_value"; |
| 1048 | uses UninterpretedOption; |
| 1049 | |
| 1050 | description |
| 1051 | "The parser stores options it doesn't recognize here. See above."; |
| 1052 | } |
| 1053 | |
| 1054 | } |
| 1055 | |
| 1056 | grouping UninterpretedOption { |
| 1057 | description |
| 1058 | "A message representing a option the parser does not recognize. This only |
| 1059 | appears in options protos created by the compiler::Parser class. |
| 1060 | DescriptorPool resolves these when building Descriptor objects. Therefore, |
| 1061 | options protos in descriptor objects (e.g. returned by Descriptor::options(), |
| 1062 | or produced by Descriptor::CopyTo()) will never have UninterpretedOptions |
| 1063 | in them."; |
| 1064 | |
| 1065 | leaf identifier_value { |
| 1066 | type string; |
| 1067 | description |
| 1068 | "The value of the uninterpreted option, in whatever type the tokenizer |
| 1069 | identified it as during parsing. Exactly one of these should be set."; |
| 1070 | } |
| 1071 | |
| 1072 | leaf positive_int_value { |
| 1073 | type uint64; |
| 1074 | description |
| 1075 | ""; |
| 1076 | } |
| 1077 | |
| 1078 | leaf negative_int_value { |
| 1079 | type int64; |
| 1080 | description |
| 1081 | ""; |
| 1082 | } |
| 1083 | |
| 1084 | leaf double_value { |
| 1085 | type decimal64 { |
| 1086 | fraction-digits 5; |
| 1087 | } |
| 1088 | description |
| 1089 | ""; |
| 1090 | } |
| 1091 | |
| 1092 | leaf string_value { |
| 1093 | type binary; |
| 1094 | description |
| 1095 | ""; |
| 1096 | } |
| 1097 | |
| 1098 | leaf aggregate_value { |
| 1099 | type string; |
| 1100 | description |
| 1101 | ""; |
| 1102 | } |
| 1103 | |
| 1104 | grouping NamePart { |
| 1105 | description |
| 1106 | "The name of the uninterpreted option. Each string represents a segment in |
| 1107 | a dot-separated name. is_extension is true iff a segment represents an |
| 1108 | extension (denoted with parentheses in options specs in .proto files). |
| 1109 | E.g., foo , false , bar.baz , true , qux , false represents |
| 1110 | foo.(bar.baz).qux ."; |
| 1111 | leaf name_part { |
| 1112 | type string; |
| 1113 | description |
| 1114 | ""; |
| 1115 | } |
| 1116 | |
| 1117 | leaf is_extension { |
| 1118 | type boolean; |
| 1119 | description |
| 1120 | ""; |
| 1121 | } |
| 1122 | |
| 1123 | } |
| 1124 | |
| 1125 | } |
| 1126 | |
| 1127 | grouping SourceCodeInfo { |
| 1128 | description |
| 1129 | "Encapsulates information about the original source file from which a |
| 1130 | FileDescriptorProto was generated. |
| 1131 | =================================================================== |
| 1132 | Optional source code info"; |
| 1133 | |
| 1134 | grouping Location { |
| 1135 | description |
| 1136 | ""; |
| 1137 | list path { |
| 1138 | key "path"; |
| 1139 | leaf path { |
| 1140 | type int32; |
| 1141 | description |
| 1142 | "Identifies which part of the FileDescriptorProto was defined at this |
| 1143 | location. |
| 1144 | |
| 1145 | Each element is a field number or an index. They form a path from |
| 1146 | the root FileDescriptorProto to the place where the definition. For |
| 1147 | example, this path: |
| 1148 | 4, 3, 2, 7, 1 |
| 1149 | refers to: |
| 1150 | file.message_type(3) 4, 3 |
| 1151 | .field(7) 2, 7 |
| 1152 | .name() 1 |
| 1153 | This is because FileDescriptorProto.message_type has field number 4: |
| 1154 | repeated DescriptorProto message_type = 4; |
| 1155 | and DescriptorProto.field has field number 2: |
| 1156 | repeated FieldDescriptorProto field = 2; |
| 1157 | and FieldDescriptorProto.name has field number 1: |
| 1158 | optional string name = 1; |
| 1159 | |
| 1160 | Thus, the above path gives the location of a field name. If we removed |
| 1161 | the last element: |
| 1162 | 4, 3, 2, 7 |
| 1163 | this path refers to the whole field declaration (from the beginning |
| 1164 | of the label to the terminating semicolon)."; |
| 1165 | } |
| 1166 | description |
| 1167 | "Identifies which part of the FileDescriptorProto was defined at this |
| 1168 | location. |
| 1169 | |
| 1170 | Each element is a field number or an index. They form a path from |
| 1171 | the root FileDescriptorProto to the place where the definition. For |
| 1172 | example, this path: |
| 1173 | 4, 3, 2, 7, 1 |
| 1174 | refers to: |
| 1175 | file.message_type(3) 4, 3 |
| 1176 | .field(7) 2, 7 |
| 1177 | .name() 1 |
| 1178 | This is because FileDescriptorProto.message_type has field number 4: |
| 1179 | repeated DescriptorProto message_type = 4; |
| 1180 | and DescriptorProto.field has field number 2: |
| 1181 | repeated FieldDescriptorProto field = 2; |
| 1182 | and FieldDescriptorProto.name has field number 1: |
| 1183 | optional string name = 1; |
| 1184 | |
| 1185 | Thus, the above path gives the location of a field name. If we removed |
| 1186 | the last element: |
| 1187 | 4, 3, 2, 7 |
| 1188 | this path refers to the whole field declaration (from the beginning |
| 1189 | of the label to the terminating semicolon)."; |
| 1190 | } |
| 1191 | |
| 1192 | list span { |
| 1193 | key "span"; |
| 1194 | leaf span { |
| 1195 | type int32; |
| 1196 | description |
| 1197 | "Always has exactly three or four elements: start line, start column, |
| 1198 | end line (optional, otherwise assumed same as start line), end column. |
| 1199 | These are packed into a single field for efficiency. Note that line |
| 1200 | and column numbers are zero-based -- typically you will want to add |
| 1201 | 1 to each before displaying to a user."; |
| 1202 | } |
| 1203 | description |
| 1204 | "Always has exactly three or four elements: start line, start column, |
| 1205 | end line (optional, otherwise assumed same as start line), end column. |
| 1206 | These are packed into a single field for efficiency. Note that line |
| 1207 | and column numbers are zero-based -- typically you will want to add |
| 1208 | 1 to each before displaying to a user."; |
| 1209 | } |
| 1210 | |
| 1211 | leaf leading_comments { |
| 1212 | type string; |
| 1213 | description |
| 1214 | "If this SourceCodeInfo represents a complete declaration, these are any |
| 1215 | comments appearing before and after the declaration which appear to be |
| 1216 | attached to the declaration. |
| 1217 | |
| 1218 | A series of line comments appearing on consecutive lines, with no other |
| 1219 | tokens appearing on those lines, will be treated as a single comment. |
| 1220 | |
| 1221 | leading_detached_comments will keep paragraphs of comments that appear |
| 1222 | before (but not connected to) the current element. Each paragraph, |
| 1223 | separated by empty lines, will be one comment element in the repeated |
| 1224 | field. |
| 1225 | |
| 1226 | Only the comment content is provided; comment markers (e.g. ) are |
| 1227 | stripped out. For block comments, leading whitespace and an asterisk |
| 1228 | will be stripped from the beginning of each line other than the first. |
| 1229 | Newlines are included in the output. |
| 1230 | |
| 1231 | Examples: |
| 1232 | |
| 1233 | optional int32 foo = 1; Comment attached to foo. |
| 1234 | Comment attached to bar. |
| 1235 | optional int32 bar = 2; |
| 1236 | |
| 1237 | optional string baz = 3; |
| 1238 | Comment attached to baz. |
| 1239 | Another line attached to baz. |
| 1240 | |
| 1241 | Comment attached to qux. |
| 1242 | |
| 1243 | Another line attached to qux. |
| 1244 | optional double qux = 4; |
| 1245 | |
| 1246 | Detached comment for corge. This is not leading or trailing comments |
| 1247 | to qux or corge because there are blank lines separating it from |
| 1248 | both. |
| 1249 | |
| 1250 | Detached comment for corge paragraph 2. |
| 1251 | |
| 1252 | optional string corge = 5; |
| 1253 | Block comment attached |
| 1254 | to corge. Leading asterisks |
| 1255 | will be removed. |
| 1256 | Block comment attached to |
| 1257 | grault. |
| 1258 | optional int32 grault = 6; |
| 1259 | |
| 1260 | ignored detached comments."; |
| 1261 | } |
| 1262 | |
| 1263 | leaf trailing_comments { |
| 1264 | type string; |
| 1265 | description |
| 1266 | ""; |
| 1267 | } |
| 1268 | |
| 1269 | list leading_detached_comments { |
| 1270 | key "leading_detached_comments"; |
| 1271 | leaf leading_detached_comments { |
| 1272 | type string; |
| 1273 | description |
| 1274 | ""; |
| 1275 | } |
| 1276 | description |
| 1277 | ""; |
| 1278 | } |
| 1279 | |
| 1280 | } |
| 1281 | |
| 1282 | } |
| 1283 | |
| 1284 | container GeneratedCodeInfo { |
| 1285 | description |
| 1286 | "Describes the relationship between generated code and its original source |
| 1287 | file. A GeneratedCodeInfo message is associated with only one generated |
| 1288 | source file, but may contain references to different source .proto files."; |
| 1289 | |
| 1290 | grouping Annotation { |
| 1291 | description |
| 1292 | ""; |
| 1293 | list path { |
| 1294 | key "path"; |
| 1295 | leaf path { |
| 1296 | type int32; |
| 1297 | description |
| 1298 | "Identifies the element in the original source .proto file. This field |
| 1299 | is formatted the same as SourceCodeInfo.Location.path."; |
| 1300 | } |
| 1301 | description |
| 1302 | "Identifies the element in the original source .proto file. This field |
| 1303 | is formatted the same as SourceCodeInfo.Location.path."; |
| 1304 | } |
| 1305 | |
| 1306 | leaf source_file { |
| 1307 | type string; |
| 1308 | description |
| 1309 | "Identifies the filesystem path to the original source .proto."; |
| 1310 | } |
| 1311 | |
| 1312 | leaf begin { |
| 1313 | type int32; |
| 1314 | description |
| 1315 | "Identifies the starting offset in bytes in the generated code |
| 1316 | that relates to the identified object."; |
| 1317 | } |
| 1318 | |
| 1319 | leaf end { |
| 1320 | type int32; |
| 1321 | description |
| 1322 | "Identifies the ending offset in bytes in the generated code that |
| 1323 | relates to the identified offset. The end offset should be one past |
| 1324 | the last relevant byte (so the length of the text = end - begin)."; |
| 1325 | } |
| 1326 | |
| 1327 | } |
| 1328 | |
| 1329 | } |
| 1330 | |
| 1331 | } |