1syntax = "proto3"; 2 3package basic_test; 4 5import "google/protobuf/wrappers.proto"; 6import "google/protobuf/timestamp.proto"; 7import "google/protobuf/duration.proto"; 8import "google/protobuf/struct.proto"; 9import "test_import_proto2.proto"; 10 11message Foo { 12 Bar bar = 1; 13 repeated Baz baz = 2; 14} 15 16message Bar { 17 string msg = 1; 18} 19 20message Baz { 21 string msg = 1; 22} 23 24message TestMessage { 25 optional int32 optional_int32 = 1; 26 optional int64 optional_int64 = 2; 27 optional uint32 optional_uint32 = 3; 28 optional uint64 optional_uint64 = 4; 29 optional bool optional_bool = 5; 30 optional float optional_float = 6; 31 optional double optional_double = 7; 32 optional string optional_string = 8; 33 optional bytes optional_bytes = 9; 34 optional TestMessage2 optional_msg = 10; 35 optional TestEnum optional_enum = 11; 36 optional foo_bar.proto2.TestImportedMessage optional_proto2_submessage = 24; 37 38 repeated int32 repeated_int32 = 12; 39 repeated int64 repeated_int64 = 13; 40 repeated uint32 repeated_uint32 = 14; 41 repeated uint64 repeated_uint64 = 15; 42 repeated bool repeated_bool = 16; 43 repeated float repeated_float = 17; 44 repeated double repeated_double = 18; 45 repeated string repeated_string = 19; 46 repeated bytes repeated_bytes = 20; 47 repeated TestMessage2 repeated_msg = 21; 48 repeated TestEnum repeated_enum = 22; 49 50 optional TestSingularFields optional_msg2 = 23; 51} 52 53message TestSingularFields { 54 int32 singular_int32 = 1; 55 int64 singular_int64 = 2; 56 uint32 singular_uint32 = 3; 57 uint64 singular_uint64 = 4; 58 bool singular_bool = 5; 59 float singular_float = 6; 60 double singular_double = 7; 61 string singular_string = 8; 62 bytes singular_bytes = 9; 63 TestMessage2 singular_msg = 10; 64 TestEnum singular_enum = 11; 65} 66 67message TestMessage2 { 68 optional int32 foo = 1; 69} 70 71enum TestEnum { 72 Default = 0; 73 A = 1; 74 B = 2; 75 C = 3; 76} 77 78message TestEmbeddedMessageParent { 79 TestEmbeddedMessageChild child_msg = 1; 80 int32 number = 2; 81 82 repeated TestEmbeddedMessageChild repeated_msg = 3; 83 repeated int32 repeated_number = 4; 84} 85 86message TestEmbeddedMessageChild { 87 TestMessage sub_child = 1; 88} 89 90message Recursive1 { 91 Recursive2 foo = 1; 92} 93 94message Recursive2 { 95 Recursive1 foo = 1; 96} 97 98message MapMessage { 99 map<string, int32> map_string_int32 = 1; 100 map<string, TestMessage2> map_string_msg = 2; 101 map<string, TestEnum> map_string_enum = 3; 102} 103 104message MapMessageWireEquiv { 105 repeated MapMessageWireEquiv_entry1 map_string_int32 = 1; 106 repeated MapMessageWireEquiv_entry2 map_string_msg = 2; 107} 108 109message MapMessageWireEquiv_entry1 { 110 string key = 1; 111 int32 value = 2; 112} 113 114message MapMessageWireEquiv_entry2 { 115 string key = 1; 116 TestMessage2 value = 2; 117} 118 119message OneofMessage { 120 oneof my_oneof { 121 string a = 1; 122 int32 b = 2; 123 TestMessage2 c = 3; 124 TestEnum d = 4; 125 } 126} 127 128message Outer { 129 map<int32, Inner> items = 1; 130} 131 132message Inner { 133} 134 135message Wrapper { 136 google.protobuf.DoubleValue double = 1; 137 google.protobuf.FloatValue float = 2; 138 google.protobuf.Int32Value int32 = 3; 139 google.protobuf.Int64Value int64 = 4; 140 google.protobuf.UInt32Value uint32 = 5; 141 google.protobuf.UInt64Value uint64 = 6; 142 google.protobuf.BoolValue bool = 7; 143 google.protobuf.StringValue string = 8; 144 google.protobuf.BytesValue bytes = 9; 145 string real_string = 100; 146 oneof a_oneof { 147 string string_in_oneof = 10; 148 } 149 150 // Repeated wrappers don't make sense, but we still need to make sure they 151 // work and don't crash. 152 repeated google.protobuf.DoubleValue repeated_double = 11; 153 repeated google.protobuf.FloatValue repeated_float = 12; 154 repeated google.protobuf.Int32Value repeated_int32 = 13; 155 repeated google.protobuf.Int64Value repeated_int64 = 14; 156 repeated google.protobuf.UInt32Value repeated_uint32 = 15; 157 repeated google.protobuf.UInt64Value repeated_uint64 = 16; 158 repeated google.protobuf.BoolValue repeated_bool = 17; 159 repeated google.protobuf.StringValue repeated_string = 18; 160 repeated google.protobuf.BytesValue repeated_bytes = 19; 161 162 // Wrappers as map keys don't make sense, but we still need to make sure they 163 // work and don't crash. 164 map<int32, google.protobuf.DoubleValue> map_double = 21; 165 map<int32, google.protobuf.FloatValue> map_float = 22; 166 map<int32, google.protobuf.Int32Value> map_int32 = 23; 167 map<int32, google.protobuf.Int64Value> map_int64 = 24; 168 map<int32, google.protobuf.UInt32Value> map_uint32 = 25; 169 map<int32, google.protobuf.UInt64Value> map_uint64 = 26; 170 map<int32, google.protobuf.BoolValue> map_bool = 27; 171 map<int32, google.protobuf.StringValue> map_string = 28; 172 map<int32, google.protobuf.BytesValue> map_bytes = 29; 173 174 // Wrappers in oneofs don't make sense, but we still need to make sure they 175 // work and don't crash. 176 oneof wrapper_oneof { 177 google.protobuf.DoubleValue oneof_double = 31; 178 google.protobuf.FloatValue oneof_float = 32; 179 google.protobuf.Int32Value oneof_int32 = 33; 180 google.protobuf.Int64Value oneof_int64 = 34; 181 google.protobuf.UInt32Value oneof_uint32 = 35; 182 google.protobuf.UInt64Value oneof_uint64 = 36; 183 google.protobuf.BoolValue oneof_bool = 37; 184 google.protobuf.StringValue oneof_string = 38; 185 google.protobuf.BytesValue oneof_bytes = 39; 186 string oneof_plain_string = 101; 187 } 188} 189 190message TimeMessage { 191 google.protobuf.Timestamp timestamp = 1; 192 google.protobuf.Duration duration = 2; 193} 194 195message Enumer { 196 TestEnum optional_enum = 1; 197 repeated TestEnum repeated_enum = 2; 198 string a_const = 3; 199 oneof a_oneof { 200 string str = 10; 201 TestEnum const = 11; 202 } 203} 204 205message MyRepeatedStruct { 206 repeated MyStruct structs = 1; 207} 208 209message MyStruct { 210 string string = 1; 211 google.protobuf.Struct struct = 2; 212} 213 214message WithJsonName { 215 optional int32 foo_bar = 1 [json_name="jsonFooBar"]; 216 repeated WithJsonName baz = 2 [json_name="jsonBaz"]; 217} 218 219message HelloRequest { 220 optional uint32 id = 1; 221 optional uint32 random_name_a0 = 2; 222 optional uint32 random_name_a1 = 3; 223 optional uint32 random_name_a2 = 4; 224 optional uint32 random_name_a3 = 5; 225 optional uint32 random_name_a4 = 6; 226 optional uint32 random_name_a5 = 7; 227 optional uint32 random_name_a6 = 8; 228 optional uint32 random_name_a7 = 9; 229 optional uint32 random_name_a8 = 10; 230 optional uint32 random_name_a9 = 11; 231 optional uint32 random_name_b0 = 12; 232 optional uint32 random_name_b1 = 13; 233 optional uint32 random_name_b2 = 14; 234 optional uint32 random_name_b3 = 15; 235 optional uint32 random_name_b4 = 16; 236 optional uint32 random_name_b5 = 17; 237 optional uint32 random_name_b6 = 18; 238 optional uint32 random_name_b7 = 19; 239 optional uint32 random_name_b8 = 20; 240 optional uint32 random_name_b9 = 21; 241 optional uint32 random_name_c0 = 22; 242 optional uint32 random_name_c1 = 23; 243 optional uint32 random_name_c2 = 24; 244 optional uint32 random_name_c3 = 25; 245 optional uint32 random_name_c4 = 26; 246 optional uint32 random_name_c5 = 27; 247 optional uint32 random_name_c6 = 28; 248 optional uint32 random_name_c7 = 29; 249 optional uint32 random_name_c8 = 30; 250 optional uint32 random_name_c9 = 31; 251 optional string version = 32; 252} 253