| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // Sanjay Ghemawat, Jeff Dean, and others. | 33 // Sanjay Ghemawat, Jeff Dean, and others. |
| 34 // | 34 // |
| 35 // The messages in this file describe the definitions found in .proto files. | 35 // The messages in this file describe the definitions found in .proto files. |
| 36 // A valid .proto file can be translated directly to a FileDescriptorProto | 36 // A valid .proto file can be translated directly to a FileDescriptorProto |
| 37 // without any other information (e.g. without reading its imports). | 37 // without any other information (e.g. without reading its imports). |
| 38 | 38 |
| 39 | 39 |
| 40 syntax = "proto2"; | 40 syntax = "proto2"; |
| 41 | 41 |
| 42 package google.protobuf; | 42 package google.protobuf; |
| 43 option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descrip
tor"; | 43 option go_package = "descriptor"; |
| 44 option java_package = "com.google.protobuf"; | 44 option java_package = "com.google.protobuf"; |
| 45 option java_outer_classname = "DescriptorProtos"; | 45 option java_outer_classname = "DescriptorProtos"; |
| 46 option csharp_namespace = "Google.Protobuf.Reflection"; | 46 option csharp_namespace = "Google.Protobuf.Reflection"; |
| 47 option objc_class_prefix = "GPB"; | 47 option objc_class_prefix = "GPB"; |
| 48 | 48 |
| 49 // descriptor.proto must be optimized for speed because reflection-based | 49 // descriptor.proto must be optimized for speed because reflection-based |
| 50 // algorithms don't work during bootstrapping. | 50 // algorithms don't work during bootstrapping. |
| 51 option optimize_for = SPEED; | 51 option optimize_for = SPEED; |
| 52 | 52 |
| 53 // The protocol compiler can output a FileDescriptorSet containing the .proto | 53 // The protocol compiler can output a FileDescriptorSet containing the .proto |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 TYPE_SFIXED64 = 16; | 150 TYPE_SFIXED64 = 16; |
| 151 TYPE_SINT32 = 17; // Uses ZigZag encoding. | 151 TYPE_SINT32 = 17; // Uses ZigZag encoding. |
| 152 TYPE_SINT64 = 18; // Uses ZigZag encoding. | 152 TYPE_SINT64 = 18; // Uses ZigZag encoding. |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 enum Label { | 155 enum Label { |
| 156 // 0 is reserved for errors | 156 // 0 is reserved for errors |
| 157 LABEL_OPTIONAL = 1; | 157 LABEL_OPTIONAL = 1; |
| 158 LABEL_REQUIRED = 2; | 158 LABEL_REQUIRED = 2; |
| 159 LABEL_REPEATED = 3; | 159 LABEL_REPEATED = 3; |
| 160 // TODO(sanjay): Should we add LABEL_MAP? |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 optional string name = 1; | 163 optional string name = 1; |
| 163 optional int32 number = 3; | 164 optional int32 number = 3; |
| 164 optional Label label = 4; | 165 optional Label label = 4; |
| 165 | 166 |
| 166 // If type_name is set, this need not be set. If both this and type_name | 167 // If type_name is set, this need not be set. If both this and type_name |
| 167 // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. | 168 // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. |
| 168 optional Type type = 5; | 169 optional Type type = 5; |
| 169 | 170 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 194 // will be used. Otherwise, it's deduced from the field's name by converting | 195 // will be used. Otherwise, it's deduced from the field's name by converting |
| 195 // it to camelCase. | 196 // it to camelCase. |
| 196 optional string json_name = 10; | 197 optional string json_name = 10; |
| 197 | 198 |
| 198 optional FieldOptions options = 8; | 199 optional FieldOptions options = 8; |
| 199 } | 200 } |
| 200 | 201 |
| 201 // Describes a oneof. | 202 // Describes a oneof. |
| 202 message OneofDescriptorProto { | 203 message OneofDescriptorProto { |
| 203 optional string name = 1; | 204 optional string name = 1; |
| 204 optional OneofOptions options = 2; | |
| 205 } | 205 } |
| 206 | 206 |
| 207 // Describes an enum type. | 207 // Describes an enum type. |
| 208 message EnumDescriptorProto { | 208 message EnumDescriptorProto { |
| 209 optional string name = 1; | 209 optional string name = 1; |
| 210 | 210 |
| 211 repeated EnumValueDescriptorProto value = 2; | 211 repeated EnumValueDescriptorProto value = 2; |
| 212 | 212 |
| 213 optional EnumOptions options = 3; | 213 optional EnumOptions options = 3; |
| 214 } | 214 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 optional string java_outer_classname = 8; | 297 optional string java_outer_classname = 8; |
| 298 | 298 |
| 299 // If set true, then the Java code generator will generate a separate .java | 299 // If set true, then the Java code generator will generate a separate .java |
| 300 // file for each top-level message, enum, and service defined in the .proto | 300 // file for each top-level message, enum, and service defined in the .proto |
| 301 // file. Thus, these types will *not* be nested inside the outer class | 301 // file. Thus, these types will *not* be nested inside the outer class |
| 302 // named by java_outer_classname. However, the outer class will still be | 302 // named by java_outer_classname. However, the outer class will still be |
| 303 // generated to contain the file's getDescriptor() method as well as any | 303 // generated to contain the file's getDescriptor() method as well as any |
| 304 // top-level extensions defined in the file. | 304 // top-level extensions defined in the file. |
| 305 optional bool java_multiple_files = 10 [default=false]; | 305 optional bool java_multiple_files = 10 [default=false]; |
| 306 | 306 |
| 307 // This option does nothing. | 307 // If set true, then the Java code generator will generate equals() and |
| 308 optional bool java_generate_equals_and_hash = 20 [deprecated=true]; | 308 // hashCode() methods for all messages defined in the .proto file. |
| 309 // This increases generated code size, potentially substantially for large |
| 310 // protos, which may harm a memory-constrained application. |
| 311 // - In the full runtime this is a speed optimization, as the |
| 312 // AbstractMessage base class includes reflection-based implementations of |
| 313 // these methods. |
| 314 // - In the lite runtime, setting this option changes the semantics of |
| 315 // equals() and hashCode() to more closely match those of the full runtime; |
| 316 // the generated methods compute their results based on field values rather |
| 317 // than object identity. (Implementations should not assume that hashcodes |
| 318 // will be consistent across runtimes or versions of the protocol compiler.) |
| 319 optional bool java_generate_equals_and_hash = 20 [default=false]; |
| 309 | 320 |
| 310 // If set true, then the Java2 code generator will generate code that | 321 // If set true, then the Java2 code generator will generate code that |
| 311 // throws an exception whenever an attempt is made to assign a non-UTF-8 | 322 // throws an exception whenever an attempt is made to assign a non-UTF-8 |
| 312 // byte sequence to a string field. | 323 // byte sequence to a string field. |
| 313 // Message reflection will do the same. | 324 // Message reflection will do the same. |
| 314 // However, an extension field still accepts non-UTF-8 byte sequences. | 325 // However, an extension field still accepts non-UTF-8 byte sequences. |
| 315 // This option has no effect on when used with the lite runtime. | 326 // This option has no effect on when used with the lite runtime. |
| 316 optional bool java_string_check_utf8 = 27 [default=false]; | 327 optional bool java_string_check_utf8 = 27 [default=false]; |
| 317 | 328 |
| 318 | 329 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 optional bool cc_enable_arenas = 31 [default=false]; | 370 optional bool cc_enable_arenas = 31 [default=false]; |
| 360 | 371 |
| 361 | 372 |
| 362 // Sets the objective c class prefix which is prepended to all objective c | 373 // Sets the objective c class prefix which is prepended to all objective c |
| 363 // generated classes from this .proto. There is no default. | 374 // generated classes from this .proto. There is no default. |
| 364 optional string objc_class_prefix = 36; | 375 optional string objc_class_prefix = 36; |
| 365 | 376 |
| 366 // Namespace for generated classes; defaults to the package. | 377 // Namespace for generated classes; defaults to the package. |
| 367 optional string csharp_namespace = 37; | 378 optional string csharp_namespace = 37; |
| 368 | 379 |
| 369 // By default Swift generators will take the proto package and CamelCase it | |
| 370 // replacing '.' with underscore and use that to prefix the types/symbols | |
| 371 // defined. When this options is provided, they will use this value instead | |
| 372 // to prefix the types/symbols defined. | |
| 373 optional string swift_prefix = 39; | |
| 374 | |
| 375 // The parser stores options it doesn't recognize here. See above. | 380 // The parser stores options it doesn't recognize here. See above. |
| 376 repeated UninterpretedOption uninterpreted_option = 999; | 381 repeated UninterpretedOption uninterpreted_option = 999; |
| 377 | 382 |
| 378 // Clients can define custom options in extensions of this message. See above. | 383 // Clients can define custom options in extensions of this message. See above. |
| 379 extensions 1000 to max; | 384 extensions 1000 to max; |
| 380 | 385 |
| 381 reserved 38; | 386 reserved 38; |
| 382 } | 387 } |
| 383 | 388 |
| 384 message MessageOptions { | 389 message MessageOptions { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // Implementations may choose not to generate the map_entry=true message, but | 434 // Implementations may choose not to generate the map_entry=true message, but |
| 430 // use a native map in the target language to hold the keys and values. | 435 // use a native map in the target language to hold the keys and values. |
| 431 // The reflection APIs in such implementions still need to work as | 436 // The reflection APIs in such implementions still need to work as |
| 432 // if the field is a repeated message field. | 437 // if the field is a repeated message field. |
| 433 // | 438 // |
| 434 // NOTE: Do not set the option in .proto files. Always use the maps syntax | 439 // NOTE: Do not set the option in .proto files. Always use the maps syntax |
| 435 // instead. The option should only be implicitly set by the proto compiler | 440 // instead. The option should only be implicitly set by the proto compiler |
| 436 // parser. | 441 // parser. |
| 437 optional bool map_entry = 7; | 442 optional bool map_entry = 7; |
| 438 | 443 |
| 439 reserved 8; // javalite_serializable | |
| 440 | |
| 441 | |
| 442 // The parser stores options it doesn't recognize here. See above. | 444 // The parser stores options it doesn't recognize here. See above. |
| 443 repeated UninterpretedOption uninterpreted_option = 999; | 445 repeated UninterpretedOption uninterpreted_option = 999; |
| 444 | 446 |
| 445 // Clients can define custom options in extensions of this message. See above. | 447 // Clients can define custom options in extensions of this message. See above. |
| 446 extensions 1000 to max; | 448 extensions 1000 to max; |
| 447 } | 449 } |
| 448 | 450 |
| 449 message FieldOptions { | 451 message FieldOptions { |
| 450 // The ctype option instructs the C++ code generator to use a different | 452 // The ctype option instructs the C++ code generator to use a different |
| 451 // representation of the field than it normally would. See the specific | 453 // representation of the field than it normally would. See the specific |
| 452 // options below. This option is not yet implemented in the open source | 454 // options below. This option is not yet implemented in the open source |
| 453 // release -- sorry, we'll try to include it in a future version! | 455 // release -- sorry, we'll try to include it in a future version! |
| 454 optional CType ctype = 1 [default = STRING]; | 456 optional CType ctype = 1 [default = STRING]; |
| 455 enum CType { | 457 enum CType { |
| 456 // Default mode. | 458 // Default mode. |
| 457 STRING = 0; | 459 STRING = 0; |
| 458 | 460 |
| 459 CORD = 1; | 461 CORD = 1; |
| 460 | 462 |
| 461 STRING_PIECE = 2; | 463 STRING_PIECE = 2; |
| 462 } | 464 } |
| 463 // The packed option can be enabled for repeated primitive fields to enable | 465 // The packed option can be enabled for repeated primitive fields to enable |
| 464 // a more efficient representation on the wire. Rather than repeatedly | 466 // a more efficient representation on the wire. Rather than repeatedly |
| 465 // writing the tag and type for each element, the entire array is encoded as | 467 // writing the tag and type for each element, the entire array is encoded as |
| 466 // a single length-delimited blob. In proto3, only explicit setting it to | 468 // a single length-delimited blob. In proto3, only explicit setting it to |
| 467 // false will avoid using packed encoding. | 469 // false will avoid using packed encoding. |
| 468 optional bool packed = 2; | 470 optional bool packed = 2; |
| 469 | 471 |
| 472 |
| 470 // The jstype option determines the JavaScript type used for values of the | 473 // The jstype option determines the JavaScript type used for values of the |
| 471 // field. The option is permitted only for 64 bit integral and fixed types | 474 // field. The option is permitted only for 64 bit integral and fixed types |
| 472 // (int64, uint64, sint64, fixed64, sfixed64). By default these types are | 475 // (int64, uint64, sint64, fixed64, sfixed64). By default these types are |
| 473 // represented as JavaScript strings. This avoids loss of precision that can | 476 // represented as JavaScript strings. This avoids loss of precision that can |
| 474 // happen when a large value is converted to a floating point JavaScript | 477 // happen when a large value is converted to a floating point JavaScript |
| 475 // numbers. Specifying JS_NUMBER for the jstype causes the generated | 478 // numbers. Specifying JS_NUMBER for the jstype causes the generated |
| 476 // JavaScript code to use the JavaScript "number" type instead of strings. | 479 // JavaScript code to use the JavaScript "number" type instead of strings. |
| 477 // This option is an enum to permit additional types to be added, | 480 // This option is an enum to permit additional types to be added, |
| 478 // e.g. goog.math.Integer. | 481 // e.g. goog.math.Integer. |
| 479 optional JSType jstype = 6 [default = JS_NORMAL]; | 482 optional JSType jstype = 6 [default = JS_NORMAL]; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 500 // overhead typically needed to implement it. | 503 // overhead typically needed to implement it. |
| 501 // | 504 // |
| 502 // This option does not affect the public interface of any generated code; | 505 // This option does not affect the public interface of any generated code; |
| 503 // all method signatures remain the same. Furthermore, thread-safety of the | 506 // all method signatures remain the same. Furthermore, thread-safety of the |
| 504 // interface is not affected by this option; const methods remain safe to | 507 // interface is not affected by this option; const methods remain safe to |
| 505 // call from multiple threads concurrently, while non-const methods continue | 508 // call from multiple threads concurrently, while non-const methods continue |
| 506 // to require exclusive access. | 509 // to require exclusive access. |
| 507 // | 510 // |
| 508 // | 511 // |
| 509 // Note that implementations may choose not to check required fields within | 512 // Note that implementations may choose not to check required fields within |
| 510 // a lazy sub-message. That is, calling IsInitialized() on the outer message | 513 // a lazy sub-message. That is, calling IsInitialized() on the outher message |
| 511 // may return true even if the inner message has missing required fields. | 514 // may return true even if the inner message has missing required fields. |
| 512 // This is necessary because otherwise the inner message would have to be | 515 // This is necessary because otherwise the inner message would have to be |
| 513 // parsed in order to perform the check, defeating the purpose of lazy | 516 // parsed in order to perform the check, defeating the purpose of lazy |
| 514 // parsing. An implementation which chooses not to check required fields | 517 // parsing. An implementation which chooses not to check required fields |
| 515 // must be consistent about it. That is, for any particular sub-message, the | 518 // must be consistent about it. That is, for any particular sub-message, the |
| 516 // implementation must either *always* check its required fields, or *never* | 519 // implementation must either *always* check its required fields, or *never* |
| 517 // check its required fields, regardless of whether or not the message has | 520 // check its required fields, regardless of whether or not the message has |
| 518 // been parsed. | 521 // been parsed. |
| 519 optional bool lazy = 5 [default=false]; | 522 optional bool lazy = 5 [default=false]; |
| 520 | 523 |
| 521 // Is this field deprecated? | 524 // Is this field deprecated? |
| 522 // Depending on the target platform, this can emit Deprecated annotations | 525 // Depending on the target platform, this can emit Deprecated annotations |
| 523 // for accessors, or it will be completely ignored; in the very least, this | 526 // for accessors, or it will be completely ignored; in the very least, this |
| 524 // is a formalization for deprecating fields. | 527 // is a formalization for deprecating fields. |
| 525 optional bool deprecated = 3 [default=false]; | 528 optional bool deprecated = 3 [default=false]; |
| 526 | 529 |
| 527 // For Google-internal migration only. Do not use. | 530 // For Google-internal migration only. Do not use. |
| 528 optional bool weak = 10 [default=false]; | 531 optional bool weak = 10 [default=false]; |
| 529 | 532 |
| 530 | 533 |
| 531 // The parser stores options it doesn't recognize here. See above. | 534 // The parser stores options it doesn't recognize here. See above. |
| 532 repeated UninterpretedOption uninterpreted_option = 999; | 535 repeated UninterpretedOption uninterpreted_option = 999; |
| 533 | 536 |
| 534 // Clients can define custom options in extensions of this message. See above. | 537 // Clients can define custom options in extensions of this message. See above. |
| 535 extensions 1000 to max; | 538 extensions 1000 to max; |
| 536 | |
| 537 reserved 4; // removed jtype | |
| 538 } | |
| 539 | |
| 540 message OneofOptions { | |
| 541 // The parser stores options it doesn't recognize here. See above. | |
| 542 repeated UninterpretedOption uninterpreted_option = 999; | |
| 543 | |
| 544 // Clients can define custom options in extensions of this message. See above. | |
| 545 extensions 1000 to max; | |
| 546 } | 539 } |
| 547 | 540 |
| 548 message EnumOptions { | 541 message EnumOptions { |
| 549 | 542 |
| 550 // Set this option to true to allow mapping different tag names to the same | 543 // Set this option to true to allow mapping different tag names to the same |
| 551 // value. | 544 // value. |
| 552 optional bool allow_alias = 2; | 545 optional bool allow_alias = 2; |
| 553 | 546 |
| 554 // Is this enum deprecated? | 547 // Is this enum deprecated? |
| 555 // Depending on the target platform, this can emit Deprecated annotations | 548 // Depending on the target platform, this can emit Deprecated annotations |
| 556 // for the enum, or it will be completely ignored; in the very least, this | 549 // for the enum, or it will be completely ignored; in the very least, this |
| 557 // is a formalization for deprecating enums. | 550 // is a formalization for deprecating enums. |
| 558 optional bool deprecated = 3 [default=false]; | 551 optional bool deprecated = 3 [default=false]; |
| 559 | 552 |
| 560 | |
| 561 // The parser stores options it doesn't recognize here. See above. | 553 // The parser stores options it doesn't recognize here. See above. |
| 562 repeated UninterpretedOption uninterpreted_option = 999; | 554 repeated UninterpretedOption uninterpreted_option = 999; |
| 563 | 555 |
| 564 // Clients can define custom options in extensions of this message. See above. | 556 // Clients can define custom options in extensions of this message. See above. |
| 565 extensions 1000 to max; | 557 extensions 1000 to max; |
| 566 } | 558 } |
| 567 | 559 |
| 568 message EnumValueOptions { | 560 message EnumValueOptions { |
| 569 // Is this enum value deprecated? | 561 // Is this enum value deprecated? |
| 570 // Depending on the target platform, this can emit Deprecated annotations | 562 // Depending on the target platform, this can emit Deprecated annotations |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 // framework. We apologize for hoarding these numbers to ourselves, but | 597 // framework. We apologize for hoarding these numbers to ourselves, but |
| 606 // we were already using them long before we decided to release Protocol | 598 // we were already using them long before we decided to release Protocol |
| 607 // Buffers. | 599 // Buffers. |
| 608 | 600 |
| 609 // Is this method deprecated? | 601 // Is this method deprecated? |
| 610 // Depending on the target platform, this can emit Deprecated annotations | 602 // Depending on the target platform, this can emit Deprecated annotations |
| 611 // for the method, or it will be completely ignored; in the very least, | 603 // for the method, or it will be completely ignored; in the very least, |
| 612 // this is a formalization for deprecating methods. | 604 // this is a formalization for deprecating methods. |
| 613 optional bool deprecated = 33 [default=false]; | 605 optional bool deprecated = 33 [default=false]; |
| 614 | 606 |
| 615 // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, | |
| 616 // or neither? HTTP based RPC implementation may choose GET verb for safe | |
| 617 // methods, and PUT verb for idempotent methods instead of the default POST. | |
| 618 enum IdempotencyLevel { | |
| 619 IDEMPOTENCY_UNKNOWN = 0; | |
| 620 NO_SIDE_EFFECTS = 1; // implies idempotent | |
| 621 IDEMPOTENT = 2; // idempotent, but may have side effects | |
| 622 } | |
| 623 optional IdempotencyLevel idempotency_level = | |
| 624 34 [default=IDEMPOTENCY_UNKNOWN]; | |
| 625 | |
| 626 // The parser stores options it doesn't recognize here. See above. | 607 // The parser stores options it doesn't recognize here. See above. |
| 627 repeated UninterpretedOption uninterpreted_option = 999; | 608 repeated UninterpretedOption uninterpreted_option = 999; |
| 628 | 609 |
| 629 // Clients can define custom options in extensions of this message. See above. | 610 // Clients can define custom options in extensions of this message. See above. |
| 630 extensions 1000 to max; | 611 extensions 1000 to max; |
| 631 } | 612 } |
| 632 | 613 |
| 633 | 614 |
| 634 // A message representing a option the parser does not recognize. This only | 615 // A message representing a option the parser does not recognize. This only |
| 635 // appears in options protos created by the compiler::Parser class. | 616 // appears in options protos created by the compiler::Parser class. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 // Identifies the starting offset in bytes in the generated code | 794 // Identifies the starting offset in bytes in the generated code |
| 814 // that relates to the identified object. | 795 // that relates to the identified object. |
| 815 optional int32 begin = 3; | 796 optional int32 begin = 3; |
| 816 | 797 |
| 817 // Identifies the ending offset in bytes in the generated code that | 798 // Identifies the ending offset in bytes in the generated code that |
| 818 // relates to the identified offset. The end offset should be one past | 799 // relates to the identified offset. The end offset should be one past |
| 819 // the last relevant byte (so the length of the text = end - begin). | 800 // the last relevant byte (so the length of the text = end - begin). |
| 820 optional int32 end = 4; | 801 optional int32 end = 4; |
| 821 } | 802 } |
| 822 } | 803 } |
| OLD | NEW |