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