...
1// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5syntax = "proto2";
6
7package google.golang.org.proto2_20160519;
8option go_package = "google.golang.org/protobuf/internal/testprotos/legacy/proto2_20160519_a4ab9ec5";
9
10enum SiblingEnum {
11 ALPHA = 0;
12 BRAVO = 10;
13 CHARLIE = 200;
14}
15
16message SiblingMessage {
17 optional string f1 = 1;
18 required string f2 = 2;
19 repeated string f3 = 3;
20 optional Message f4 = 4;
21}
22
23message Message {
24 enum ChildEnum {
25 ALPHA = 0;
26 BRAVO = 1;
27 CHARLIE = 2;
28 }
29 message ChildMessage {
30 optional string f1 = 1;
31 required string f2 = 2;
32 repeated string f3 = 3;
33 optional Message f4 = 4;
34 }
35 optional group NamedGroup = 1 {
36 optional string f1 = 1;
37 required string f2 = 2;
38 repeated string f3 = 3;
39 optional Message f4 = 4;
40 }
41
42 // Optional fields.
43 optional bool optional_bool = 100;
44 optional int32 optional_int32 = 101;
45 optional sint32 optional_sint32 = 102;
46 optional uint32 optional_uint32 = 103;
47 optional int64 optional_int64 = 104;
48 optional sint64 optional_sint64 = 105;
49 optional uint64 optional_uint64 = 106;
50 optional fixed32 optional_fixed32 = 107;
51 optional sfixed32 optional_sfixed32 = 108;
52 optional float optional_float = 109;
53 optional fixed64 optional_fixed64 = 110;
54 optional sfixed64 optional_sfixed64 = 111;
55 optional double optional_double = 112;
56 optional string optional_string = 113;
57 optional bytes optional_bytes = 114;
58
59 optional ChildEnum optional_child_enum = 115;
60 optional ChildMessage optional_child_message = 116;
61 optional NamedGroup optional_named_group = 117;
62 optional SiblingEnum optional_sibling_enum = 118;
63 optional SiblingMessage optional_sibling_message = 119;
64 optional group OptionalGroup = 120 {
65 optional string f1 = 1;
66 required string f2 = 2;
67 repeated string f3 = 3;
68 }
69
70 // Optional default fields.
71 optional bool defaulted_bool = 200 [default = true];
72 optional int32 defaulted_int32 = 201 [default = -12345];
73 optional sint32 defaulted_sint32 = 202 [default = -3200];
74 optional uint32 defaulted_uint32 = 203 [default = 3200];
75 optional int64 defaulted_int64 = 204 [default = -123456789];
76 optional sint64 defaulted_sint64 = 205 [default = -6400];
77 optional uint64 defaulted_uint64 = 206 [default = 6400];
78 optional fixed32 defaulted_fixed32 = 207 [default = 320000];
79 optional sfixed32 defaulted_sfixed32 = 208 [default = -320000];
80 optional float defaulted_float = 209 [default = 3.14159];
81 optional fixed64 defaulted_fixed64 = 210 [default = 640000];
82 optional sfixed64 defaulted_sfixed64 = 211 [default = -640000];
83 optional double defaulted_double = 212 [default = 3.14159265359];
84 optional string defaulted_string = 213 [default = "hello, \"world!\"\n"];
85 optional bytes defaulted_bytes = 214 [default = "dead\xde\xad\xbe\xefbeef"];
86
87 optional ChildEnum defaulted_child_enum = 215 [default = ALPHA];
88 optional SiblingEnum defaulted_sibling_enum = 216 [default = ALPHA];
89
90 // Required fields.
91 required bool required_bool = 300;
92 required int32 required_int32 = 301;
93 required sint32 required_sint32 = 302;
94 required uint32 required_uint32 = 303;
95 required int64 required_int64 = 304;
96 required sint64 required_sint64 = 305;
97 required uint64 required_uint64 = 306;
98 required fixed32 required_fixed32 = 307;
99 required sfixed32 required_sfixed32 = 308;
100 required float required_float = 309;
101 required fixed64 required_fixed64 = 310;
102 required sfixed64 required_sfixed64 = 311;
103 required double required_double = 312;
104 required string required_string = 313;
105 required bytes required_bytes = 314;
106
107 required ChildEnum required_child_enum = 315;
108 required ChildMessage required_child_message = 316;
109 required NamedGroup required_named_group = 317;
110 required SiblingEnum required_sibling_enum = 318;
111 required SiblingMessage required_sibling_message = 319;
112 required group RequiredGroup = 320 {
113 optional string f1 = 1;
114 required string f2 = 2;
115 repeated string f3 = 3;
116 }
117 // Required default fields.
118 required bool required_defaulted_bool = 400 [default = true];
119 required int32 required_defaulted_int32 = 401 [default = -12345];
120 required sint32 required_defaulted_sint32 = 402 [default = -3200];
121 required uint32 required_defaulted_uint32 = 403 [default = 3200];
122 required int64 required_defaulted_int64 = 404 [default = -123456789];
123 required sint64 required_defaulted_sint64 = 405 [default = -6400];
124 required uint64 required_defaulted_uint64 = 406 [default = 6400];
125 required fixed32 required_defaulted_fixed32 = 407 [default = 320000];
126 required sfixed32 required_defaulted_sfixed32 = 408 [default = -320000];
127 required float required_defaulted_float = 409 [default = 3.14159];
128 required fixed64 required_defaulted_fixed64 = 410 [default = 640000];
129 required sfixed64 required_defaulted_sfixed64 = 411 [default = -640000];
130 required double required_defaulted_double = 412 [default = 3.14159265359];
131 required string required_defaulted_string = 413 [default = "hello, \"world!\"\n"];
132 required bytes required_defaulted_bytes = 414 [default = "dead\xde\xad\xbe\xefbeef"];
133
134 required ChildEnum required_defaulted_child_enum = 415 [default = ALPHA];
135 required SiblingEnum required_defaulted_sibling_enum = 416 [default = ALPHA];
136
137 // Repeated fields.
138 repeated bool repeated_bool = 500;
139 repeated int32 repeated_int32 = 501;
140 repeated sint32 repeated_sint32 = 502;
141 repeated uint32 repeated_uint32 = 503;
142 repeated int64 repeated_int64 = 504;
143 repeated sint64 repeated_sint64 = 505;
144 repeated uint64 repeated_uint64 = 506;
145 repeated fixed32 repeated_fixed32 = 507;
146 repeated sfixed32 repeated_sfixed32 = 508;
147 repeated float repeated_float = 509;
148 repeated fixed64 repeated_fixed64 = 510;
149 repeated sfixed64 repeated_sfixed64 = 511;
150 repeated double repeated_double = 512;
151 repeated string repeated_string = 513;
152 repeated bytes repeated_bytes = 514;
153
154 repeated ChildEnum repeated_child_enum = 515;
155 repeated ChildMessage repeated_child_message = 516;
156 repeated NamedGroup repeated_named_group = 517;
157 repeated SiblingEnum repeated_sibling_enum = 518;
158 repeated SiblingMessage repeated_sibling_message = 519;
159 repeated group RepeatedGroup = 520 {
160 optional string f1 = 1;
161 required string f2 = 2;
162 repeated string f3 = 3;
163 }
164
165 // Map fields.
166 map<bool, bool> map_bool_bool = 600;
167 map<bool, int32> map_bool_int32 = 601;
168 map<bool, sint32> map_bool_sint32 = 602;
169 map<bool, uint32> map_bool_uint32 = 603;
170 map<bool, int64> map_bool_int64 = 604;
171 map<bool, sint64> map_bool_sint64 = 605;
172 map<bool, uint64> map_bool_uint64 = 606;
173 map<bool, fixed32> map_bool_fixed32 = 607;
174 map<bool, sfixed32> map_bool_sfixed32 = 608;
175 map<bool, float> map_bool_float = 609;
176 map<bool, fixed64> map_bool_fixed64 = 610;
177 map<bool, sfixed64> map_bool_sfixed64 = 611;
178 map<bool, double> map_bool_double = 612;
179 map<bool, string> map_bool_string = 613;
180 map<bool, bytes> map_bool_bytes = 614;
181
182 map<bool, ChildEnum> map_bool_child_enum = 615;
183 map<bool, ChildMessage> map_bool_child_message = 616;
184 map<bool, NamedGroup> map_bool_named_group = 617;
185 map<bool, SiblingEnum> map_bool_sibling_enum = 618;
186 map<bool, SiblingMessage> map_bool_sibling_message = 619;
187
188 map<int32, bool> map_int32_bool = 620;
189 map<sint32, bool> map_sint32_bool = 621;
190 map<uint32, bool> map_uint32_bool = 622;
191 map<int64, bool> map_int64_bool = 623;
192 map<sint64, bool> map_sint64_bool = 624;
193 map<uint64, bool> map_uint64_bool = 625;
194 map<fixed32, bool> map_fixed32_bool = 626;
195 map<string, bool> map_string_bool = 627;
196
197 // Oneof fields.
198 oneof oneof_union {
199 bool oneof_bool = 700;
200 int32 oneof_int32 = 701;
201 sint32 oneof_sint32 = 702;
202 uint32 oneof_uint32 = 703;
203 int64 oneof_int64 = 704;
204 sint64 oneof_sint64 = 705;
205 uint64 oneof_uint64 = 706;
206 fixed32 oneof_fixed32 = 707;
207 sfixed32 oneof_sfixed32 = 708;
208 float oneof_float = 709;
209 fixed64 oneof_fixed64 = 710;
210 sfixed64 oneof_sfixed64 = 711;
211 double oneof_double = 712;
212 string oneof_string = 713;
213 bytes oneof_bytes = 714;
214
215 ChildEnum oneof_child_enum = 715;
216 ChildMessage oneof_child_message = 716;
217 NamedGroup oneof_named_group = 717;
218 SiblingEnum oneof_sibling_enum = 718;
219 SiblingMessage oneof_sibling_message = 719;
220 group OneofGroup = 720 {
221 optional string f1 = 1;
222 required string f2 = 2;
223 repeated string f3 = 3;
224 }
225
226 string oneof_string1 = 721;
227 string oneof_string2 = 722;
228 string oneof_string3 = 723;
229 }
230
231 // Oneof default fields.
232 oneof oneof_defaulted_union {
233 bool oneof_defaulted_bool = 800 [default = true];
234 int32 oneof_defaulted_int32 = 801 [default = -12345];
235 sint32 oneof_defaulted_sint32 = 802 [default = -3200];
236 uint32 oneof_defaulted_uint32 = 803 [default = 3200];
237 int64 oneof_defaulted_int64 = 804 [default = -123456789];
238 sint64 oneof_defaulted_sint64 = 805 [default = -6400];
239 uint64 oneof_defaulted_uint64 = 806 [default = 6400];
240 fixed32 oneof_defaulted_fixed32 = 807 [default = 320000];
241 sfixed32 oneof_defaulted_sfixed32 = 808 [default = -320000];
242 float oneof_defaulted_float = 809 [default = 3.14159];
243 fixed64 oneof_defaulted_fixed64 = 810 [default = 640000];
244 sfixed64 oneof_defaulted_sfixed64 = 811 [default = -640000];
245 double oneof_defaulted_double = 812 [default = 3.14159265359];
246 string oneof_defaulted_string = 813 [default = "hello, \"world!\"\n"];
247 bytes oneof_defaulted_bytes = 814 [default = "dead\xde\xad\xbe\xefbeef"];
248
249 ChildEnum oneof_defaulted_child_enum = 815 [default = ALPHA];
250 SiblingEnum oneof_defaulted_sibling_enum = 816 [default = ALPHA];
251 }
252
253 // Extension fields.
254 extend Message {
255 // Optional fields.
256 optional bool extension_optional_bool = 10000;
257 optional int32 extension_optional_int32 = 10001;
258 optional sint32 extension_optional_sint32 = 10002;
259 optional uint32 extension_optional_uint32 = 10003;
260 optional int64 extension_optional_int64 = 10004;
261 optional sint64 extension_optional_sint64 = 10005;
262 optional uint64 extension_optional_uint64 = 10006;
263 optional fixed32 extension_optional_fixed32 = 10007;
264 optional sfixed32 extension_optional_sfixed32 = 10008;
265 optional float extension_optional_float = 10009;
266 optional fixed64 extension_optional_fixed64 = 10010;
267 optional sfixed64 extension_optional_sfixed64 = 10011;
268 optional double extension_optional_double = 10012;
269 optional string extension_optional_string = 10013;
270 optional bytes extension_optional_bytes = 10014;
271
272 optional ChildEnum extension_optional_child_enum = 10015;
273 optional ChildMessage extension_optional_child_message = 10016;
274 optional NamedGroup extension_optional_named_group = 10017;
275 optional SiblingEnum extension_optional_sibling_enum = 10018;
276 optional SiblingMessage extension_optional_sibling_message = 10019;
277 optional group ExtensionOptionalGroup = 10020 {
278 optional string f1 = 1;
279 required string f2 = 2;
280 repeated string f3 = 3;
281 }
282
283 // Optional default fields.
284 optional bool extension_defaulted_bool = 20000 [default = true];
285 optional int32 extension_defaulted_int32 = 20001 [default = -12345];
286 optional sint32 extension_defaulted_sint32 = 20002 [default = -3200];
287 optional uint32 extension_defaulted_uint32 = 20003 [default = 3200];
288 optional int64 extension_defaulted_int64 = 20004 [default = -123456789];
289 optional sint64 extension_defaulted_sint64 = 20005 [default = -6400];
290 optional uint64 extension_defaulted_uint64 = 20006 [default = 6400];
291 optional fixed32 extension_defaulted_fixed32 = 20007 [default = 320000];
292 optional sfixed32 extension_defaulted_sfixed32 = 20008 [default = -320000];
293 optional float extension_defaulted_float = 20009 [default = 3.14159];
294 optional fixed64 extension_defaulted_fixed64 = 20010 [default = 640000];
295 optional sfixed64 extension_defaulted_sfixed64 = 20011 [default = -640000];
296 optional double extension_defaulted_double = 20012 [default = 3.14159265359];
297 optional string extension_defaulted_string = 20013 [default = "hello, \"world!\"\n"];
298 optional bytes extension_defaulted_bytes = 20014 [default = "dead\xde\xad\xbe\xefbeef"];
299
300 optional ChildEnum extension_defaulted_child_enum = 20015 [default = ALPHA];
301 optional SiblingEnum extension_defaulted_sibling_enum = 20016 [default = ALPHA];
302
303 // Repeated fields.
304 repeated bool extension_repeated_bool = 30000;
305 repeated int32 extension_repeated_int32 = 30001;
306 repeated sint32 extension_repeated_sint32 = 30002;
307 repeated uint32 extension_repeated_uint32 = 30003;
308 repeated int64 extension_repeated_int64 = 30004;
309 repeated sint64 extension_repeated_sint64 = 30005;
310 repeated uint64 extension_repeated_uint64 = 30006;
311 repeated fixed32 extension_repeated_fixed32 = 30007;
312 repeated sfixed32 extension_repeated_sfixed32 = 30008;
313 repeated float extension_repeated_float = 30009;
314 repeated fixed64 extension_repeated_fixed64 = 30010;
315 repeated sfixed64 extension_repeated_sfixed64 = 30011;
316 repeated double extension_repeated_double = 30012;
317 repeated string extension_repeated_string = 30013;
318 repeated bytes extension_repeated_bytes = 30014;
319
320 repeated ChildEnum extension_repeated_child_enum = 30015;
321 repeated ChildMessage extension_repeated_child_message = 30016;
322 repeated NamedGroup extension_repeated_named_group = 30017;
323 repeated SiblingEnum extension_repeated_sibling_enum = 30018;
324 repeated SiblingMessage extension_repeated_sibling_message = 30019;
325 repeated group ExtensionRepeatedGroup = 30020 {
326 optional string f1 = 1;
327 required string f2 = 2;
328 repeated string f3 = 3;
329 }
330 }
331
332 extensions 10000 to max;
333}
View as plain text