1// Protocol Buffers - Google's data interchange format
2// Copyright 2011 Google Inc.  All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
8//     * Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10//     * Redistributions in binary form must reproduce the above
11// copyright notice, this list of conditions and the following disclaimer
12// in the documentation and/or other materials provided with the
13// distribution.
14//     * Neither the name of Google Inc. nor the names of its
15// contributors may be used to endorse or promote products derived from
16// this software without specific prior written permission.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30syntax = "proto2";
31
32import "google/protobuf/any.proto";
33import "google/protobuf/unittest.proto";
34
35package protobuf_unittest;
36
37// Used to check that Headerdocs and appledoc work correctly. If these comments
38// are not handled correctly, Xcode will fail to build the tests.
39message TestGeneratedComments {
40  // This is a string that could contain stuff like
41  // mime types as image/* or */plain. Maybe twitter usernames
42  // like @protobuf, @google or @something.
43  optional string string_field = 1;
44}
45
46// Using the messages in unittest.proto, setup for recursive cases for testing
47// extensions at various depths.
48extend TestAllExtensions {
49  optional TestAllExtensions recursive_extension = 86;
50}
51
52// Recursive message to for testing autocreators at different depths.
53message TestRecursiveMessageWithRepeatedField {
54  optional TestRecursiveMessageWithRepeatedField a = 1;
55  repeated int32 i = 2;
56  repeated string str = 3;
57  map<int32, int32> i_to_i = 4;
58  map<string, string> str_to_str = 5;
59}
60
61// Message with a few types of maps to cover the different custom flows
62// in the runtime.
63message TestMessageOfMaps {
64  map<string, string> str_to_str = 1;
65
66  map<string, int32> str_to_int = 2;
67  map<int32, string> int_to_str = 3;
68  map<int32, int32> int_to_int = 4;
69
70  map<string, bool> str_to_bool = 5;
71  map<bool, string> bool_to_str = 6;
72  map<bool, bool> bool_to_bool = 7;
73
74  map<int32, bool> int_to_bool = 8;
75  map<bool, int32> bool_to_int = 9;
76
77  map<string, TestAllTypes> str_to_msg = 10;
78  map<int32, TestAllTypes> int_to_msg = 11;
79  map<bool, TestAllTypes> bool_to_msg = 12;
80}
81
82// Recursive message and extension to for testing autocreators at different
83// depths.
84message TestRecursiveExtension {
85  optional TestRecursiveExtension recursive_sub_message = 1;
86  repeated int32 repeated_value = 2;
87  extensions 1000 to max;
88}
89
90extend TestRecursiveExtension {
91  optional TestRecursiveExtension recursive_message_extension = 1000;
92}
93
94message self {
95  message super {
96    optional int32 description = 1;
97  }
98
99  enum autorelease {
100    retain      = 1;
101    release     = 2;
102    retainCount = 3;
103  }
104
105  // Singular
106  // Objective C Keywords
107  optional bool id                =  1;
108  optional bool _cmd              =  2;
109  // super is used as submessage above
110  optional bool in                =  4;
111  optional bool out               =  5;
112  optional bool inout             =  6;
113  optional bool bycopy            =  7;
114  optional bool byref             =  8;
115  optional bool oneway            =  9;
116  optional bool self              =  10;
117  optional bool instancetype      =  11;
118  optional bool nullable          =  12;
119  optional bool nonnull           =  13;
120  optional bool nil               =  14;
121  // Nil and nil can't be in the same message
122  optional bool YES               =  16;
123  optional bool NO                =  17;
124  optional bool weak              =  18;
125
126  // Some C/C++ Keywords
127  optional bool case              = 30;
128  optional bool if                = 31;
129  optional bool and_eq            = 32;
130  optional bool public            = 33;
131  optional bool private           = 34;
132  optional bool typename          = 35;
133  optional bool static_cast       = 36;
134  optional bool typeof            = 37;
135  optional bool restrict          = 38;
136  optional bool NULL              = 39;
137
138  // Some NSObject Methods
139  optional bool dealloc           = 110;
140  optional bool isProxy           = 111;
141  optional bool copy              = 112;
142  optional bool description       = 113;
143  optional bool zone              = 114;
144  optional bool className         = 115;
145  optional bool __retain_OA       = 116;
146  optional bool CAMLType          = 117;
147  optional bool isNSDictionary__  = 118;
148  optional bool accessibilityLabel = 119;
149
150  // Some Objc "keywords" that we shouldn't
151  // have to worry about because they
152  // can only appear in specialized areas.
153  optional bool assign            = 200;
154  optional bool getter            = 201;
155  optional bool setter            = 202;
156  optional bool atomic            = 203;
157  optional bool nonatomic         = 204;
158  optional bool strong            = 205;
159  optional bool null_resettable   = 206;
160  optional bool readonly          = 207;
161
162  // Some GPBMessage methods
163  optional bool clear             = 300;
164  optional bool data              = 301;
165  optional bool descriptor        = 302;
166  optional bool delimitedData     = 303;
167
168  // Some MacTypes
169  optional bool Fixed             = 400;
170  optional bool Point             = 401;
171  optional bool FixedPoint        = 402;
172  optional bool Style             = 403;
173
174  // C/C++ reserved identifiers
175  optional bool _Generic          = 500;
176  optional bool __block           = 501;
177
178  // Try a keyword as a type
179  optional autorelease SubEnum    = 1000;
180
181  optional group New = 2000 {
182   optional string copy = 1;
183  }
184  optional group MutableCopy = 2001 {
185    optional int32 extensionRegistry = 1;
186  }
187
188  extensions 3000 to 3999;
189
190}
191
192enum retain {
193  count          = 4;
194  initialized    = 5;
195  serializedSize = 6;
196}
197
198message ObjCPropertyNaming {
199  // Test that the properties properly get things all caps.
200  optional string url           = 1;
201  optional string thumbnail_url = 2;
202  optional string url_foo       = 3;
203  optional string some_url_blah = 4;
204  optional string http          = 5;
205  optional string https         = 6;
206  // This one doesn't.
207  repeated string urls          = 7;
208}
209
210// EnumValueShortName: The short names shouldn't get suffixes/prefixes.
211enum Foo {
212  SERIALIZED_SIZE = 1;
213  SIZE            = 2;
214  OTHER           = 3;
215}
216
217// EnumValueShortName: The enum name gets a prefix.
218enum Category {
219  RED  = 1;
220  BLUE = 2;
221}
222
223// EnumValueShortName: Twist case, full name gets PB, but the short names
224// should still end up correct.
225enum Time {
226  BASE            = 1;
227  RECORD          = 2;
228  SOMETHING_ELSE  = 3;
229}
230
231extend self {
232  repeated    int32 debugDescription    =  3000 [packed = true];
233  repeated    int64 finalize            =  3001 [packed = true];
234  repeated   uint32 hash                =  3002 [packed = true];
235  repeated   uint64 classForCoder       =  3003 [packed = true];
236  repeated   sint32 byref               =  3004 [packed = true];
237}
238
239// Test handing of fields that start with init* since Xcode 5's ARC support
240// doesn't like messages that look like initializers but aren't.
241message ObjCInitFoo {
242  optional string init_val = 11;
243  optional int32 init_size = 12;
244  optional self init_self = 13;
245
246  repeated string init_vals = 21;
247  repeated int32 init_sizes = 22;
248  repeated self init_selfs = 23;
249}
250
251// Test handling of fields that start with retained names.
252message ObjCRetainedFoo {
253  optional string new_val_lower_complex = 11;
254  optional string new_Val_upper_complex = 12;
255  optional string newvalue_lower_no_underscore_complex = 13;
256  optional string newValue_upper_no_underscore_complex = 14;
257
258  optional int32 new_val_lower_primitive = 15;
259  optional int32 new_Val_upper_primitive = 16;
260  optional int32 newvalue_lower_no_underscore_primitive = 17;
261  optional int32 newValue_upper_no_underscore_primitive = 18;
262
263  optional self new_val_lower_message = 19;
264  optional self new_Val_upper_message = 20;
265  optional self newvalue_lower_no_underscore_message = 21;
266  optional self newValue_upper_no_underscore_message = 22;
267
268  optional Foo new_val_lower_enum = 23;
269  optional Foo new_Val_upper_enum = 24;
270  optional Foo newvalue_lower_no_underscore_enum = 25;
271  optional Foo newValue_upper_no_underscore_enum = 26;
272
273  repeated string new_val_lower_complex_repeated = 111;
274  repeated string new_Val_upper_complex_repeated = 112;
275  repeated string newvalue_lower_no_underscore_complex_repeated = 113;
276  repeated string newValue_upper_no_underscore_complex_repeated = 114;
277
278  repeated int32 new_val_lower_primitive_repeated = 115;
279  repeated int32 new_Val_upper_primitive_repeated = 116;
280  repeated int32 newvalue_lower_no_underscore_primitive_repeated = 117;
281  repeated int32 newValue_upper_no_underscore_primitive_repeated = 118;
282
283  repeated self new_val_lower_message_repeated = 119;
284  repeated self new_Val_upper_message_repeated = 120;
285  repeated self newvalue_lower_no_underscore_message_repeated = 121;
286  repeated self newValue_upper_no_underscore_message_repeated = 122;
287
288  repeated Foo new_val_lower_enum_repeated = 123;
289  repeated Foo new_Val_upper_enum_repeated = 124;
290  repeated Foo newvalue_lower_no_underscore_enum_repeated = 125;
291  repeated Foo newValue_upper_no_underscore_enum_repeated = 126;
292
293  optional string alloc_val_lower_complex = 211;
294  optional string alloc_Val_upper_complex = 212;
295  optional string allocvalue_lower_no_underscore_complex = 213;
296  optional string allocValue_upper_no_underscore_complex = 214;
297
298  optional int32 alloc_val_lower_primitive = 215;
299  optional int32 alloc_Val_upper_primitive = 216;
300  optional int32 allocvalue_lower_no_underscore_primitive = 217;
301  optional int32 allocValue_upper_no_underscore_primitive = 218;
302
303  optional self alloc_val_lower_message = 219;
304  optional self alloc_Val_upper_message = 220;
305  optional self allocvalue_lower_no_underscore_message = 221;
306  optional self allocValue_upper_no_underscore_message = 222;
307
308  optional Foo alloc_val_lower_enum = 223;
309  optional Foo alloc_Val_upper_enum = 224;
310  optional Foo allocvalue_lower_no_underscore_enum = 225;
311  optional Foo allocValue_upper_no_underscore_enum = 226;
312
313  repeated string alloc_val_lower_complex_repeated = 311;
314  repeated string alloc_Val_upper_complex_repeated = 312;
315  repeated string allocvalue_lower_no_underscore_complex_repeated = 313;
316  repeated string allocValue_upper_no_underscore_complex_repeated = 314;
317
318  repeated int32 alloc_val_lower_primitive_repeated = 315;
319  repeated int32 alloc_Val_upper_primitive_repeated = 316;
320  repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 317;
321  repeated int32 allocValue_upper_no_underscore_primitive_repeated = 318;
322
323  repeated self alloc_val_lower_message_repeated = 319;
324  repeated self alloc_Val_upper_message_repeated = 320;
325  repeated self allocvalue_lower_no_underscore_message_repeated = 321;
326  repeated self allocValue_upper_no_underscore_message_repeated = 322;
327
328  repeated Foo alloc_val_lower_enum_repeated = 323;
329  repeated Foo alloc_Val_upper_enum_repeated = 324;
330  repeated Foo allocvalue_lower_no_underscore_enum_repeated = 325;
331  repeated Foo allocValue_upper_no_underscore_enum_repeated = 326;
332
333  optional string copy_val_lower_complex = 411;
334  optional string copy_Val_upper_complex = 412;
335  optional string copyvalue_lower_no_underscore_complex = 413;
336  optional string copyValue_upper_no_underscore_complex = 414;
337
338  optional int32 copy_val_lower_primitive = 415;
339  optional int32 copy_Val_upper_primitive = 416;
340  optional int32 copyvalue_lower_no_underscore_primitive = 417;
341  optional int32 copyValue_upper_no_underscore_primitive = 418;
342
343  optional self copy_val_lower_message = 419;
344  optional self copy_Val_upper_message = 420;
345  optional self copyvalue_lower_no_underscore_message = 421;
346  optional self copyValue_upper_no_underscore_message = 422;
347
348  optional Foo copy_val_lower_enum = 423;
349  optional Foo copy_Val_upper_enum = 424;
350  optional Foo copyvalue_lower_no_underscore_enum = 425;
351  optional Foo copyValue_upper_no_underscore_enum = 426;
352
353  repeated string copy_val_lower_complex_repeated = 511;
354  repeated string copy_Val_upper_complex_repeated = 512;
355  repeated string copyvalue_lower_no_underscore_complex_repeated = 513;
356  repeated string copyValue_upper_no_underscore_complex_repeated = 514;
357
358  repeated int32 copy_val_lower_primitive_repeated = 515;
359  repeated int32 copy_Val_upper_primitive_repeated = 516;
360  repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 517;
361  repeated int32 copyValue_upper_no_underscore_primitive_repeated = 518;
362
363  repeated self copy_val_lower_message_repeated = 519;
364  repeated self copy_Val_upper_message_repeated = 520;
365  repeated self copyvalue_lower_no_underscore_message_repeated = 521;
366  repeated self copyValue_upper_no_underscore_message_repeated = 522;
367
368  repeated Foo copy_val_lower_enum_repeated = 523;
369  repeated Foo copy_Val_upper_enum_repeated = 524;
370  repeated Foo copyvalue_lower_no_underscore_enum_repeated = 525;
371  repeated Foo copyValue_upper_no_underscore_enum_repeated = 526;
372
373  optional string mutableCopy_val_lower_complex = 611;
374  optional string mutableCopy_Val_upper_complex = 612;
375  optional string mutableCopyvalue_lower_no_underscore_complex = 613;
376  optional string mutableCopyValue_upper_no_underscore_complex = 614;
377
378  optional int32 mutableCopy_val_lower_primitive = 615;
379  optional int32 mutableCopy_Val_upper_primitive = 616;
380  optional int32 mutableCopyvalue_lower_no_underscore_primitive = 617;
381  optional int32 mutableCopyValue_upper_no_underscore_primitive = 618;
382
383  optional self mutableCopy_val_lower_message = 619;
384  optional self mutableCopy_Val_upper_message = 620;
385  optional self mutableCopyvalue_lower_no_underscore_message = 621;
386  optional self mutableCopyValue_upper_no_underscore_message = 622;
387
388  optional Foo mutableCopy_val_lower_enum = 623;
389  optional Foo mutableCopy_Val_upper_enum = 624;
390  optional Foo mutableCopyvalue_lower_no_underscore_enum = 625;
391  optional Foo mutableCopyValue_upper_no_underscore_enum = 626;
392
393  repeated string mutableCopy_val_lower_complex_repeated = 711;
394  repeated string mutableCopy_Val_upper_complex_repeated = 712;
395  repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 713;
396  repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 714;
397
398  repeated int32 mutableCopy_val_lower_primitive_repeated = 715;
399  repeated int32 mutableCopy_Val_upper_primitive_repeated = 716;
400  repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 717;
401  repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 718;
402
403  repeated self mutableCopy_val_lower_message_repeated = 719;
404  repeated self mutableCopy_Val_upper_message_repeated = 720;
405  repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 721;
406  repeated self mutableCopyValue_upper_no_underscore_message_repeated = 722;
407
408  repeated Foo mutableCopy_val_lower_enum_repeated = 723;
409  repeated Foo mutableCopy_Val_upper_enum_repeated = 724;
410  repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 725;
411  repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 726;
412
413  extensions 1000 to 3999;
414}
415
416// Extension fields with retained names.
417extend ObjCRetainedFoo {
418  optional string new_val_lower_complex = 1011;
419  optional string new_Val_upper_complex = 1012;
420  optional string newvalue_lower_no_underscore_complex = 1013;
421  optional string newValue_upper_no_underscore_complex = 1014;
422
423  optional int32 new_val_lower_primitive = 1015;
424  optional int32 new_Val_upper_primitive = 1016;
425  optional int32 newvalue_lower_no_underscore_primitive = 1017;
426  optional int32 newValue_upper_no_underscore_primitive = 1018;
427
428  optional self new_val_lower_message = 1019;
429  optional self new_Val_upper_message = 1020;
430  optional self newvalue_lower_no_underscore_message = 1021;
431  optional self newValue_upper_no_underscore_message = 1022;
432
433  optional Foo new_val_lower_enum = 1023;
434  optional Foo new_Val_upper_enum = 1024;
435  optional Foo newvalue_lower_no_underscore_enum = 1025;
436  optional Foo newValue_upper_no_underscore_enum = 1026;
437
438  repeated string new_val_lower_complex_repeated = 1111;
439  repeated string new_Val_upper_complex_repeated = 1112;
440  repeated string newvalue_lower_no_underscore_complex_repeated = 1113;
441  repeated string newValue_upper_no_underscore_complex_repeated = 1114;
442
443  repeated int32 new_val_lower_primitive_repeated = 1115;
444  repeated int32 new_Val_upper_primitive_repeated = 1116;
445  repeated int32 newvalue_lower_no_underscore_primitive_repeated = 1117;
446  repeated int32 newValue_upper_no_underscore_primitive_repeated = 1118;
447
448  repeated self new_val_lower_message_repeated = 1119;
449  repeated self new_Val_upper_message_repeated = 1120;
450  repeated self newvalue_lower_no_underscore_message_repeated = 1121;
451  repeated self newValue_upper_no_underscore_message_repeated = 1122;
452
453  repeated Foo new_val_lower_enum_repeated = 1123;
454  repeated Foo new_Val_upper_enum_repeated = 1124;
455  repeated Foo newvalue_lower_no_underscore_enum_repeated = 1125;
456  repeated Foo newValue_upper_no_underscore_enum_repeated = 1126;
457
458  optional string alloc_val_lower_complex = 1211;
459  optional string alloc_Val_upper_complex = 1212;
460  optional string allocvalue_lower_no_underscore_complex = 1213;
461  optional string allocValue_upper_no_underscore_complex = 1214;
462
463  optional int32 alloc_val_lower_primitive = 1215;
464  optional int32 alloc_Val_upper_primitive = 1216;
465  optional int32 allocvalue_lower_no_underscore_primitive = 1217;
466  optional int32 allocValue_upper_no_underscore_primitive = 1218;
467
468  optional self alloc_val_lower_message = 1219;
469  optional self alloc_Val_upper_message = 1220;
470  optional self allocvalue_lower_no_underscore_message = 1221;
471  optional self allocValue_upper_no_underscore_message = 1222;
472
473  optional Foo alloc_val_lower_enum = 1223;
474  optional Foo alloc_Val_upper_enum = 1224;
475  optional Foo allocvalue_lower_no_underscore_enum = 1225;
476  optional Foo allocValue_upper_no_underscore_enum = 1226;
477
478  repeated string alloc_val_lower_complex_repeated = 1311;
479  repeated string alloc_Val_upper_complex_repeated = 1312;
480  repeated string allocvalue_lower_no_underscore_complex_repeated = 1313;
481  repeated string allocValue_upper_no_underscore_complex_repeated = 1314;
482
483  repeated int32 alloc_val_lower_primitive_repeated = 1315;
484  repeated int32 alloc_Val_upper_primitive_repeated = 1316;
485  repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 1317;
486  repeated int32 allocValue_upper_no_underscore_primitive_repeated = 1318;
487
488  repeated self alloc_val_lower_message_repeated = 1319;
489  repeated self alloc_Val_upper_message_repeated = 1320;
490  repeated self allocvalue_lower_no_underscore_message_repeated = 1321;
491  repeated self allocValue_upper_no_underscore_message_repeated = 1322;
492
493  repeated Foo alloc_val_lower_enum_repeated = 1323;
494  repeated Foo alloc_Val_upper_enum_repeated = 1324;
495  repeated Foo allocvalue_lower_no_underscore_enum_repeated = 1325;
496  repeated Foo allocValue_upper_no_underscore_enum_repeated = 1326;
497
498  optional string copy_val_lower_complex = 1411;
499  optional string copy_Val_upper_complex = 1412;
500  optional string copyvalue_lower_no_underscore_complex = 1413;
501  optional string copyValue_upper_no_underscore_complex = 1414;
502
503  optional int32 copy_val_lower_primitive = 1415;
504  optional int32 copy_Val_upper_primitive = 1416;
505  optional int32 copyvalue_lower_no_underscore_primitive = 1417;
506  optional int32 copyValue_upper_no_underscore_primitive = 1418;
507
508  optional self copy_val_lower_message = 1419;
509  optional self copy_Val_upper_message = 1420;
510  optional self copyvalue_lower_no_underscore_message = 1421;
511  optional self copyValue_upper_no_underscore_message = 1422;
512
513  optional Foo copy_val_lower_enum = 1423;
514  optional Foo copy_Val_upper_enum = 1424;
515  optional Foo copyvalue_lower_no_underscore_enum = 1425;
516  optional Foo copyValue_upper_no_underscore_enum = 1426;
517
518  repeated string copy_val_lower_complex_repeated = 1511;
519  repeated string copy_Val_upper_complex_repeated = 1512;
520  repeated string copyvalue_lower_no_underscore_complex_repeated = 1513;
521  repeated string copyValue_upper_no_underscore_complex_repeated = 1514;
522
523  repeated int32 copy_val_lower_primitive_repeated = 1515;
524  repeated int32 copy_Val_upper_primitive_repeated = 1516;
525  repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 1517;
526  repeated int32 copyValue_upper_no_underscore_primitive_repeated = 1518;
527
528  repeated self copy_val_lower_message_repeated = 1519;
529  repeated self copy_Val_upper_message_repeated = 1520;
530  repeated self copyvalue_lower_no_underscore_message_repeated = 1521;
531  repeated self copyValue_upper_no_underscore_message_repeated = 1522;
532
533  repeated Foo copy_val_lower_enum_repeated = 1523;
534  repeated Foo copy_Val_upper_enum_repeated = 1524;
535  repeated Foo copyvalue_lower_no_underscore_enum_repeated = 1525;
536  repeated Foo copyValue_upper_no_underscore_enum_repeated = 1526;
537
538  optional string mutableCopy_val_lower_complex = 1611;
539  optional string mutableCopy_Val_upper_complex = 1612;
540  optional string mutableCopyvalue_lower_no_underscore_complex = 1613;
541  optional string mutableCopyValue_upper_no_underscore_complex = 1614;
542
543  optional int32 mutableCopy_val_lower_primitive = 1615;
544  optional int32 mutableCopy_Val_upper_primitive = 1616;
545  optional int32 mutableCopyvalue_lower_no_underscore_primitive = 1617;
546  optional int32 mutableCopyValue_upper_no_underscore_primitive = 1618;
547
548  optional self mutableCopy_val_lower_message = 1619;
549  optional self mutableCopy_Val_upper_message = 1620;
550  optional self mutableCopyvalue_lower_no_underscore_message = 1621;
551  optional self mutableCopyValue_upper_no_underscore_message = 1622;
552
553  optional Foo mutableCopy_val_lower_enum = 1623;
554  optional Foo mutableCopy_Val_upper_enum = 1624;
555  optional Foo mutableCopyvalue_lower_no_underscore_enum = 1625;
556  optional Foo mutableCopyValue_upper_no_underscore_enum = 1626;
557
558  repeated string mutableCopy_val_lower_complex_repeated = 1711;
559  repeated string mutableCopy_Val_upper_complex_repeated = 1712;
560  repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 1713;
561  repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 1714;
562
563  repeated int32 mutableCopy_val_lower_primitive_repeated = 1715;
564  repeated int32 mutableCopy_Val_upper_primitive_repeated = 1716;
565  repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 1717;
566  repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 1718;
567
568  repeated self mutableCopy_val_lower_message_repeated = 1719;
569  repeated self mutableCopy_Val_upper_message_repeated = 1720;
570  repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 1721;
571  repeated self mutableCopyValue_upper_no_underscore_message_repeated = 1722;
572
573  repeated Foo mutableCopy_val_lower_enum_repeated = 1723;
574  repeated Foo mutableCopy_Val_upper_enum_repeated = 1724;
575  repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 1725;
576  repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 1726;
577}
578
579message JustToScopeExtensions {
580  extend ObjCRetainedFoo {
581    optional string new_val_lower_complex = 2011;
582    optional string new_Val_upper_complex = 2012;
583    optional string newvalue_lower_no_underscore_complex = 2013;
584    optional string newValue_upper_no_underscore_complex = 2014;
585
586    optional int32 new_val_lower_primitive = 2015;
587    optional int32 new_Val_upper_primitive = 2016;
588    optional int32 newvalue_lower_no_underscore_primitive = 2017;
589    optional int32 newValue_upper_no_underscore_primitive = 2018;
590
591    optional self new_val_lower_message = 2019;
592    optional self new_Val_upper_message = 2020;
593    optional self newvalue_lower_no_underscore_message = 2021;
594    optional self newValue_upper_no_underscore_message = 2022;
595
596    optional Foo new_val_lower_enum = 2023;
597    optional Foo new_Val_upper_enum = 2024;
598    optional Foo newvalue_lower_no_underscore_enum = 2025;
599    optional Foo newValue_upper_no_underscore_enum = 2026;
600
601    repeated string new_val_lower_complex_repeated = 2111;
602    repeated string new_Val_upper_complex_repeated = 2112;
603    repeated string newvalue_lower_no_underscore_complex_repeated = 2113;
604    repeated string newValue_upper_no_underscore_complex_repeated = 2114;
605
606    repeated int32 new_val_lower_primitive_repeated = 2115;
607    repeated int32 new_Val_upper_primitive_repeated = 2116;
608    repeated int32 newvalue_lower_no_underscore_primitive_repeated = 2117;
609    repeated int32 newValue_upper_no_underscore_primitive_repeated = 2118;
610
611    repeated self new_val_lower_message_repeated = 2119;
612    repeated self new_Val_upper_message_repeated = 2120;
613    repeated self newvalue_lower_no_underscore_message_repeated = 2121;
614    repeated self newValue_upper_no_underscore_message_repeated = 2122;
615
616    repeated Foo new_val_lower_enum_repeated = 2123;
617    repeated Foo new_Val_upper_enum_repeated = 2124;
618    repeated Foo newvalue_lower_no_underscore_enum_repeated = 2125;
619    repeated Foo newValue_upper_no_underscore_enum_repeated = 2126;
620
621    optional string alloc_val_lower_complex = 2211;
622    optional string alloc_Val_upper_complex = 2212;
623    optional string allocvalue_lower_no_underscore_complex = 2213;
624    optional string allocValue_upper_no_underscore_complex = 2214;
625
626    optional int32 alloc_val_lower_primitive = 2215;
627    optional int32 alloc_Val_upper_primitive = 2216;
628    optional int32 allocvalue_lower_no_underscore_primitive = 2217;
629    optional int32 allocValue_upper_no_underscore_primitive = 2218;
630
631    optional self alloc_val_lower_message = 2219;
632    optional self alloc_Val_upper_message = 2220;
633    optional self allocvalue_lower_no_underscore_message = 2221;
634    optional self allocValue_upper_no_underscore_message = 2222;
635
636    optional Foo alloc_val_lower_enum = 2223;
637    optional Foo alloc_Val_upper_enum = 2224;
638    optional Foo allocvalue_lower_no_underscore_enum = 2225;
639    optional Foo allocValue_upper_no_underscore_enum = 2226;
640
641    repeated string alloc_val_lower_complex_repeated = 2311;
642    repeated string alloc_Val_upper_complex_repeated = 2312;
643    repeated string allocvalue_lower_no_underscore_complex_repeated = 2313;
644    repeated string allocValue_upper_no_underscore_complex_repeated = 2314;
645
646    repeated int32 alloc_val_lower_primitive_repeated = 2315;
647    repeated int32 alloc_Val_upper_primitive_repeated = 2316;
648    repeated int32 allocvalue_lower_no_underscore_primitive_repeated = 2317;
649    repeated int32 allocValue_upper_no_underscore_primitive_repeated = 2318;
650
651    repeated self alloc_val_lower_message_repeated = 2319;
652    repeated self alloc_Val_upper_message_repeated = 2320;
653    repeated self allocvalue_lower_no_underscore_message_repeated = 2321;
654    repeated self allocValue_upper_no_underscore_message_repeated = 2322;
655
656    repeated Foo alloc_val_lower_enum_repeated = 2323;
657    repeated Foo alloc_Val_upper_enum_repeated = 2324;
658    repeated Foo allocvalue_lower_no_underscore_enum_repeated = 2325;
659    repeated Foo allocValue_upper_no_underscore_enum_repeated = 2326;
660
661    optional string copy_val_lower_complex = 2411;
662    optional string copy_Val_upper_complex = 2412;
663    optional string copyvalue_lower_no_underscore_complex = 2413;
664    optional string copyValue_upper_no_underscore_complex = 2414;
665
666    optional int32 copy_val_lower_primitive = 2415;
667    optional int32 copy_Val_upper_primitive = 2416;
668    optional int32 copyvalue_lower_no_underscore_primitive = 2417;
669    optional int32 copyValue_upper_no_underscore_primitive = 2418;
670
671    optional self copy_val_lower_message = 2419;
672    optional self copy_Val_upper_message = 2420;
673    optional self copyvalue_lower_no_underscore_message = 2421;
674    optional self copyValue_upper_no_underscore_message = 2422;
675
676    optional Foo copy_val_lower_enum = 2423;
677    optional Foo copy_Val_upper_enum = 2424;
678    optional Foo copyvalue_lower_no_underscore_enum = 2425;
679    optional Foo copyValue_upper_no_underscore_enum = 2426;
680
681    repeated string copy_val_lower_complex_repeated = 2511;
682    repeated string copy_Val_upper_complex_repeated = 2512;
683    repeated string copyvalue_lower_no_underscore_complex_repeated = 2513;
684    repeated string copyValue_upper_no_underscore_complex_repeated = 2514;
685
686    repeated int32 copy_val_lower_primitive_repeated = 2515;
687    repeated int32 copy_Val_upper_primitive_repeated = 2516;
688    repeated int32 copyvalue_lower_no_underscore_primitive_repeated = 2517;
689    repeated int32 copyValue_upper_no_underscore_primitive_repeated = 2518;
690
691    repeated self copy_val_lower_message_repeated = 2519;
692    repeated self copy_Val_upper_message_repeated = 2520;
693    repeated self copyvalue_lower_no_underscore_message_repeated = 2521;
694    repeated self copyValue_upper_no_underscore_message_repeated = 2522;
695
696    repeated Foo copy_val_lower_enum_repeated = 2523;
697    repeated Foo copy_Val_upper_enum_repeated = 2524;
698    repeated Foo copyvalue_lower_no_underscore_enum_repeated = 2525;
699    repeated Foo copyValue_upper_no_underscore_enum_repeated = 2526;
700
701    optional string mutableCopy_val_lower_complex = 2611;
702    optional string mutableCopy_Val_upper_complex = 2612;
703    optional string mutableCopyvalue_lower_no_underscore_complex = 2613;
704    optional string mutableCopyValue_upper_no_underscore_complex = 2614;
705
706    optional int32 mutableCopy_val_lower_primitive = 2615;
707    optional int32 mutableCopy_Val_upper_primitive = 2616;
708    optional int32 mutableCopyvalue_lower_no_underscore_primitive = 2617;
709    optional int32 mutableCopyValue_upper_no_underscore_primitive = 2618;
710
711    optional self mutableCopy_val_lower_message = 2619;
712    optional self mutableCopy_Val_upper_message = 2620;
713    optional self mutableCopyvalue_lower_no_underscore_message = 2621;
714    optional self mutableCopyValue_upper_no_underscore_message = 2622;
715
716    optional Foo mutableCopy_val_lower_enum = 2623;
717    optional Foo mutableCopy_Val_upper_enum = 2624;
718    optional Foo mutableCopyvalue_lower_no_underscore_enum = 2625;
719    optional Foo mutableCopyValue_upper_no_underscore_enum = 2626;
720
721    repeated string mutableCopy_val_lower_complex_repeated = 2711;
722    repeated string mutableCopy_Val_upper_complex_repeated = 2712;
723    repeated string mutableCopyvalue_lower_no_underscore_complex_repeated = 2713;
724    repeated string mutableCopyValue_upper_no_underscore_complex_repeated = 2714;
725
726    repeated int32 mutableCopy_val_lower_primitive_repeated = 2715;
727    repeated int32 mutableCopy_Val_upper_primitive_repeated = 2716;
728    repeated int32 mutableCopyvalue_lower_no_underscore_primitive_repeated = 2717;
729    repeated int32 mutableCopyValue_upper_no_underscore_primitive_repeated = 2718;
730
731    repeated self mutableCopy_val_lower_message_repeated = 2719;
732    repeated self mutableCopy_Val_upper_message_repeated = 2720;
733    repeated self mutableCopyvalue_lower_no_underscore_message_repeated = 2721;
734    repeated self mutableCopyValue_upper_no_underscore_message_repeated = 2722;
735
736    repeated Foo mutableCopy_val_lower_enum_repeated = 2723;
737    repeated Foo mutableCopy_Val_upper_enum_repeated = 2724;
738    repeated Foo mutableCopyvalue_lower_no_underscore_enum_repeated = 2725;
739    repeated Foo mutableCopyValue_upper_no_underscore_enum_repeated = 2726;
740  }
741}
742
743// Test handling of fields that are the retained names.
744message ObjCRetainedComplex {
745  optional string new = 1;
746  optional string alloc = 2;
747  optional string copy = 3;
748  optional string mutableCopy = 4;
749}
750
751message ObjCRetainedComplexRepeated {
752  repeated string new = 1;
753  repeated string alloc = 2;
754  repeated string copy = 3;
755  repeated string mutableCopy = 4;
756}
757
758message ObjCRetainedPrimitive {
759  optional int32 new = 1;
760  optional int32 alloc = 2;
761  optional int32 copy = 3;
762  optional int32 mutableCopy = 4;
763}
764
765message ObjCRetainedPrimitiveRepeated {
766  repeated int32 new = 1;
767  repeated int32 alloc = 2;
768  repeated int32 copy = 3;
769  repeated int32 mutableCopy = 4;
770}
771
772message ObjCRetainedMessage {
773  optional self new = 1;
774  optional self alloc = 2;
775  optional self copy = 3;
776  optional self mutableCopy = 4;
777}
778
779message ObjCRetainedMessageRepeated {
780  repeated self new = 1;
781  repeated self alloc = 2;
782  repeated self copy = 3;
783  repeated self mutableCopy = 4;
784}
785
786// Test Handling some MacTypes
787message Point {
788  message Rect {
789    optional int32 TimeValue = 1;
790  }
791}
792
793// Test some weird defaults that we see in protos.
794message ObjcWeirdDefaults {
795  // Set default values that match the protocol buffer defined defaults to
796  // confirm hasDefault and the default values are set correctly.
797  optional string foo = 1 [default = ""];
798  optional bytes bar = 2 [default = ""];
799}
800
801// Used to confirm negative enum values work as expected.
802message EnumTestMsg {
803  enum MyEnum {
804    ZERO    = 0;
805    ONE     = 1;
806    TWO     = 2;
807    NEG_ONE = -1;
808    NEG_TWO = -2;
809  }
810  optional MyEnum foo = 1;
811  optional MyEnum bar = 2 [default = ONE];
812  optional MyEnum baz = 3 [default = NEG_ONE];
813
814  repeated MyEnum mumble = 4;
815}
816
817// Test case for https://github.com/protocolbuffers/protobuf/issues/1453
818// Message with no explicit defaults, but a non zero default for an enum.
819message MessageWithOneBasedEnum {
820  enum OneBasedEnum {
821    ONE = 1;
822    TWO = 2;
823  }
824  optional OneBasedEnum enum_field = 1;
825}
826
827// Message with all bools for testing things related to bool storage.
828message BoolOnlyMessage {
829  optional bool bool_field_1 = 1;
830  optional bool bool_field_2 = 2;
831  optional bool bool_field_3 = 3;
832  optional bool bool_field_4 = 4;
833  optional bool bool_field_5 = 5;
834  optional bool bool_field_6 = 6;
835  optional bool bool_field_7 = 7;
836  optional bool bool_field_8 = 8;
837  optional bool bool_field_9 = 9;
838  optional bool bool_field_10 = 10;
839  optional bool bool_field_11 = 11;
840  optional bool bool_field_12 = 12;
841  optional bool bool_field_13 = 13;
842  optional bool bool_field_14 = 14;
843  optional bool bool_field_15 = 15;
844  optional bool bool_field_16 = 16;
845  optional bool bool_field_17 = 17;
846  optional bool bool_field_18 = 18;
847  optional bool bool_field_19 = 19;
848  optional bool bool_field_20 = 20;
849  optional bool bool_field_21 = 21;
850  optional bool bool_field_22 = 22;
851  optional bool bool_field_23 = 23;
852  optional bool bool_field_24 = 24;
853  optional bool bool_field_25 = 25;
854  optional bool bool_field_26 = 26;
855  optional bool bool_field_27 = 27;
856  optional bool bool_field_28 = 28;
857  optional bool bool_field_29 = 29;
858  optional bool bool_field_30 = 30;
859  optional bool bool_field_31 = 31;
860  optional bool bool_field_32 = 32;
861}
862
863// Reference to a WKT to test (via generated code inspection), the handling
864// of #imports.  Within the WKTs, references to each other are just path
865// based imports, but when reference from another proto file, they should be
866// conditional to support the framework import style.
867message WKTRefereceMessage {
868  optional google.protobuf.Any an_any = 1;
869}
870
871// This is in part a compile test, it ensures that when aliases end up with
872// the same ObjC name, we drop them to avoid the duplication names. There
873// is a test to ensure the descriptors are still generated to support
874// reflection and TextFormat.
875enum TestEnumObjCNameCollision {
876  option allow_alias = true;
877
878  FOO = 1;
879  foo = 1;
880
881  BAR = 2;
882  mumble = 2;
883  MUMBLE = 2;
884}
885