Protocol Buffers - Google's data interchange format (grpc依赖) https://developers.google.com/protocol-buffers/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
5.1 KiB

syntax = "proto3";
import 'proto/test_include.proto';
import 'proto/test_prefix.proto';
package foo;
message TestMessage {
// Singular
int32 optional_int32 = 1;
int64 optional_int64 = 2;
uint32 optional_uint32 = 3;
uint64 optional_uint64 = 4;
sint32 optional_sint32 = 5;
sint64 optional_sint64 = 6;
fixed32 optional_fixed32 = 7;
fixed64 optional_fixed64 = 8;
sfixed32 optional_sfixed32 = 9;
sfixed64 optional_sfixed64 = 10;
float optional_float = 11;
double optional_double = 12;
bool optional_bool = 13;
string optional_string = 14;
bytes optional_bytes = 15;
TestEnum optional_enum = 16;
Sub optional_message = 17;
bar.TestInclude optional_included_message = 18;
TestMessage recursive = 19;
// Repeated
repeated int32 repeated_int32 = 31;
repeated int64 repeated_int64 = 32;
repeated uint32 repeated_uint32 = 33;
repeated uint64 repeated_uint64 = 34;
repeated sint32 repeated_sint32 = 35;
repeated sint64 repeated_sint64 = 36;
repeated fixed32 repeated_fixed32 = 37;
repeated fixed64 repeated_fixed64 = 38;
repeated sfixed32 repeated_sfixed32 = 39;
repeated sfixed64 repeated_sfixed64 = 40;
repeated float repeated_float = 41;
repeated double repeated_double = 42;
repeated bool repeated_bool = 43;
repeated string repeated_string = 44;
repeated bytes repeated_bytes = 45;
repeated TestEnum repeated_enum = 46;
repeated Sub repeated_message = 47;
repeated TestMessage repeated_recursive = 48;
oneof my_oneof {
int32 oneof_int32 = 51;
int64 oneof_int64 = 52;
uint32 oneof_uint32 = 53;
uint64 oneof_uint64 = 54;
uint32 oneof_sint32 = 55;
uint64 oneof_sint64 = 56;
uint32 oneof_fixed32 = 57;
uint64 oneof_fixed64 = 58;
uint32 oneof_sfixed32 = 59;
uint64 oneof_sfixed64 = 60;
double oneof_double = 61;
float oneof_float = 62;
bool oneof_bool = 63;
string oneof_string = 64;
bytes oneof_bytes = 65;
TestEnum oneof_enum = 66;
Sub oneof_message = 67;
}
map<int32, int32> map_int32_int32 = 71;
map<int64, int64> map_int64_int64 = 72;
map<uint32, uint32> map_uint32_uint32 = 73;
map<uint64, uint64> map_uint64_uint64 = 74;
map<sint32, sint32> map_sint32_sint32 = 75;
map<sint64, sint64> map_sint64_sint64 = 76;
map<fixed32, fixed32> map_fixed32_fixed32 = 77;
map<fixed64, fixed64> map_fixed64_fixed64 = 78;
map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 79;
map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 80;
map<int32, float> map_int32_float = 81;
map<int32, double> map_int32_double = 82;
map<bool, bool> map_bool_bool = 83;
map<string, string> map_string_string = 84;
map<int32, bytes> map_int32_bytes = 85;
map<int32, TestEnum> map_int32_enum = 86;
map<int32, Sub> map_int32_message = 87;
map<int32, TestMessage> map_recursive = 88;
message Sub {
int32 a = 1;
repeated int32 b = 2;
}
Merge 3.2.x branch into master (#2648) * Down-integrate internal changes to github. * Update conformance test failure list. * Explicitly import used class in nano test to avoid random test fail. * Update _GNUC_VER to use the correct implementation of atomic operation on Mac. * maps_test.js: check whether Symbol is defined before using it (#2524) Symbol is not yet available on older versions of Node.js and so this test fails with them. This change just directly checks whether Symbol is available before we try to use it. * Added well_known_types_embed.cc to CLEANFILES so that it gets cleaned up * Updated Makefile.am to fix out-of-tree builds * Added Bazel genrule for generating well_known_types_embed.cc In pull request #2517 I made this change for the CMake and autotools builds but forgot to do it for the Bazel build. * Update _GNUC_VER to use the correct implementation of atomic operation on Mac. * Add new js file in extra dist. * Bump version number to 3.2.0 * Fixed issue with autoloading - Invalid paths (#2538) * PHP fix int64 decoding (#2516) * fix int64 decoding * fix int64 decoding + tests * Fix int64 decoding on 32-bit machines. * Fix warning in compiler/js/embed.cc embed.cc: In function ‘std::string CEscape(const string&)’: embed.cc:51:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < str.size(); ++i) { ^ * Fix include in auto-generated well_known_types_embed.cc Restore include style fix (e3da722) that has been trampled by auto-generation of well_known_types_embed.cc * Fixed cross compilations with the Autotools build Pull request #2517 caused cross compilations to start failing, because the js_embed binary was being built to run on the target platform instead of on the build machine. This change updates the Autotools build to use the AX_PROG_CXX_FOR_BUILD macro to find a suitable compiler for the build machine and always use that when building js_embed. * Minor fix for autocreated object repeated fields and maps. - If setting/clearing a repeated field/map that was objects, check the class before checking the autocreator. - Just to be paranoid, don’t mutate within copy/mutableCopy for the autocreated classes to ensure there is less chance of issues if someone does something really crazy threading wise. - Some more tests for the internal AutocreatedArray/AutocreatedDictionary classes to ensure things are working as expected. - Add Xcode 8.2 to the full_mac_build.sh supported list. * Fix generation of extending nested messages in JavaScript (#2439) * Fix generation of extending nested messages in JavaScript * Added missing test8.proto to build * Fix generated code when there is no namespace but there is enum definition. * Decoding unknown field should succeed. * Add embed.cc in src/Makefile.am to fix dist check. * Fixed "make distcheck" for the Autotools build To make the test pass I needed to fix out-of-tree builds and update EXTRA_DIST and CLEANFILES. * Remove redundent embed.cc from src/Makefile.am * Update version number to 3.2.0-rc.1 (#2578) * Change protoc-artifacts version to 3.2.0-rc.1 * Update version number to 3.2.0rc2 * Update change logs for 3.2.0 release. * Update php README * Update upb, fixes some bugs (including a hash table problem). (#2611) * Update upb, fixes some bugs (including a hash table problem). * Ruby: added a test for the previous hash table corruption. Verified that this triggers the bug in the currently released version. * Ruby: bugfix for SEGV. * Ruby: removed old code for dup'ing defs. * Reverting deployment target to 7.0 (#2618) The Protobuf library doesn’t require the 7.1 deployment target so reverting it back to 7.0 * Fix typo that breaks builds on big-endian (#2632) * Bump version number to 3.2.0
8 years ago
// Reserved for non-existing field test.
// int32 non_exist = 89;
}
enum TestEnum {
ZERO = 0;
ONE = 1;
TWO = 2;
}
message TestPackedMessage {
repeated int32 repeated_int32 = 90 [packed = true];
repeated int64 repeated_int64 = 91 [packed = true];
repeated uint32 repeated_uint32 = 92 [packed = true];
repeated uint64 repeated_uint64 = 93 [packed = true];
repeated sint32 repeated_sint32 = 94 [packed = true];
repeated sint64 repeated_sint64 = 95 [packed = true];
repeated fixed32 repeated_fixed32 = 96 [packed = true];
repeated fixed64 repeated_fixed64 = 97 [packed = true];
repeated sfixed32 repeated_sfixed32 = 98 [packed = true];
repeated sfixed64 repeated_sfixed64 = 99 [packed = true];
repeated float repeated_float = 100 [packed = true];
repeated double repeated_double = 101 [packed = true];
repeated bool repeated_bool = 102 [packed = true];
repeated TestEnum repeated_enum = 103 [packed = true];
}
// Need to be in sync with TestPackedMessage.
message TestUnpackedMessage {
repeated int32 repeated_int32 = 90 [packed = false];
repeated int64 repeated_int64 = 91 [packed = false];
repeated uint32 repeated_uint32 = 92 [packed = false];
repeated uint64 repeated_uint64 = 93 [packed = false];
repeated sint32 repeated_sint32 = 94 [packed = false];
repeated sint64 repeated_sint64 = 95 [packed = false];
repeated fixed32 repeated_fixed32 = 96 [packed = false];
repeated fixed64 repeated_fixed64 = 97 [packed = false];
repeated sfixed32 repeated_sfixed32 = 98 [packed = false];
repeated sfixed64 repeated_sfixed64 = 99 [packed = false];
repeated float repeated_float = 100 [packed = false];
repeated double repeated_double = 101 [packed = false];
repeated bool repeated_bool = 102 [packed = false];
repeated TestEnum repeated_enum = 103 [packed = false];
}
// /**/@<>&\{
message TestPhpDoc {
int32 a = 1;
}
message TestIncludePrefixMessage {
TestPrefix prefix_message = 1;
}