test.proto 14 KB

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