• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1syntax = "proto3";
2
3import 'google/protobuf/any.proto';
4import 'google/protobuf/wrappers.proto';
5import 'google/protobuf/struct.proto';
6import 'proto/test_include.proto';
7import 'proto/test_no_namespace.proto';
8import 'proto/test_php_namespace.proto';
9import 'proto/test_empty_php_namespace.proto';
10import 'proto/test_prefix.proto';
11
12package foo;
13
14message TestMessage {
15  // Singular
16  int32 optional_int32 = 1;
17  int64 optional_int64 = 2;
18  uint32 optional_uint32 = 3;
19  uint64 optional_uint64 = 4;
20  sint32 optional_sint32 = 5;
21  sint64 optional_sint64 = 6;
22  fixed32 optional_fixed32 = 7;
23  fixed64 optional_fixed64 = 8;
24  sfixed32 optional_sfixed32 = 9;
25  sfixed64 optional_sfixed64 = 10;
26  float optional_float = 11;
27  double optional_double = 12;
28  bool optional_bool = 13;
29  string optional_string = 14;
30  bytes optional_bytes = 15;
31
32  TestEnum optional_enum = 16;
33  Sub optional_message = 17;
34  bar.TestInclude optional_included_message = 18;
35  TestMessage recursive = 19;
36
37  // True optional
38  optional int32 true_optional_int32 = 201;
39  optional int64 true_optional_int64 = 202;
40  optional uint32 true_optional_uint32 = 203;
41  optional uint64 true_optional_uint64 = 204;
42  optional sint32 true_optional_sint32 = 205;
43  optional sint64 true_optional_sint64 = 206;
44  optional fixed32 true_optional_fixed32 = 207;
45  optional fixed64 true_optional_fixed64 = 208;
46  optional sfixed32 true_optional_sfixed32 = 209;
47  optional sfixed64 true_optional_sfixed64 = 210;
48  optional float true_optional_float = 211;
49  optional double true_optional_double = 212;
50  optional bool true_optional_bool = 213;
51  optional string true_optional_string = 214;
52  optional bytes true_optional_bytes = 215;
53
54  optional TestEnum true_optional_enum = 216;
55  optional Sub true_optional_message = 217;
56  optional bar.TestInclude true_optional_included_message = 218;
57
58  // Repeated
59  repeated    int32 repeated_int32    = 31;
60  repeated    int64 repeated_int64    = 32;
61  repeated   uint32 repeated_uint32   = 33;
62  repeated   uint64 repeated_uint64   = 34;
63  repeated   sint32 repeated_sint32   = 35;
64  repeated   sint64 repeated_sint64   = 36;
65  repeated  fixed32 repeated_fixed32  = 37;
66  repeated  fixed64 repeated_fixed64  = 38;
67  repeated sfixed32 repeated_sfixed32 = 39;
68  repeated sfixed64 repeated_sfixed64 = 40;
69  repeated    float repeated_float    = 41;
70  repeated   double repeated_double   = 42;
71  repeated     bool repeated_bool     = 43;
72  repeated   string repeated_string   = 44;
73  repeated    bytes repeated_bytes    = 45;
74
75  repeated TestEnum repeated_enum = 46;
76  repeated Sub repeated_message = 47;
77  repeated TestMessage repeated_recursive = 48;
78
79  oneof my_oneof {
80    int32  oneof_int32    = 51;
81    int64  oneof_int64    = 52;
82    uint32 oneof_uint32   = 53;
83    uint64 oneof_uint64   = 54;
84    uint32 oneof_sint32   = 55;
85    uint64 oneof_sint64   = 56;
86    uint32 oneof_fixed32  = 57;
87    uint64 oneof_fixed64  = 58;
88    uint32 oneof_sfixed32 = 59;
89    uint64 oneof_sfixed64 = 60;
90    double oneof_double   = 61;
91    float  oneof_float    = 62;
92    bool   oneof_bool     = 63;
93    string oneof_string   = 64;
94    bytes  oneof_bytes    = 65;
95    TestEnum oneof_enum   = 66;
96    Sub    oneof_message  = 67;
97  }
98
99  map<int32,       int32> map_int32_int32       = 71;
100  map<int64,       int64> map_int64_int64       = 72;
101  map<uint32,     uint32> map_uint32_uint32     = 73;
102  map<uint64,     uint64> map_uint64_uint64     = 74;
103  map<sint32,     sint32> map_sint32_sint32     = 75;
104  map<sint64,     sint64> map_sint64_sint64     = 76;
105  map<fixed32,   fixed32> map_fixed32_fixed32   = 77;
106  map<fixed64,   fixed64> map_fixed64_fixed64   = 78;
107  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 79;
108  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 80;
109  map<int32,       float> map_int32_float       = 81;
110  map<int32,      double> map_int32_double      = 82;
111  map<bool,         bool> map_bool_bool         = 83;
112  map<string,     string> map_string_string     = 84;
113  map<int32,       bytes> map_int32_bytes       = 85;
114  map<int32,    TestEnum> map_int32_enum        = 86;
115  map<int32,         Sub> map_int32_message     = 87;
116
117  map<int32, TestMessage> map_recursive = 88;
118
119  message Sub {
120    int32 a = 1;
121    repeated int32 b = 2;
122  }
123
124  // Reserved for non-existing field test.
125  // int32 non_exist = 89;
126
127  NoNamespaceMessage optional_no_namespace_message = 91;
128  NoNamespaceEnum optional_no_namespace_enum = 92;
129  repeated NoNamespaceMessage repeated_no_namespace_message = 93;
130  repeated NoNamespaceEnum repeated_no_namespace_enum = 94;
131
132  enum NestedEnum {
133    ZERO = 0;
134  }
135
136  NestedEnum optional_nested_enum = 101;
137
138  // Test prefix for reserved words.
139  message Empty {
140    int32 a = 1;
141  }
142
143  reserved 111;
144
145  // Test map with missing message value
146  map<string, TestMessage> map_string_message = 121;
147  map<string, google.protobuf.Any> map_string_any = 122;
148  map<string, google.protobuf.ListValue> map_string_list = 123;
149  map<string, google.protobuf.Struct> map_string_struct = 124;
150}
151
152enum TestEnum {
153  ZERO = 0;
154  ONE  = 1;
155  TWO  = 2;
156  ECHO = 3;  // Test reserved name.
157}
158
159// Test prefix for reserved words.
160message Empty {
161  int32 a = 1;
162}
163
164message ARRAY {
165  int32 a = 1;
166}
167
168message TestPackedMessage {
169  repeated int32    repeated_int32    = 90  [packed = true];
170  repeated int64    repeated_int64    = 91  [packed = true];
171  repeated uint32   repeated_uint32   = 92  [packed = true];
172  repeated uint64   repeated_uint64   = 93  [packed = true];
173  repeated sint32   repeated_sint32   = 94  [packed = true];
174  repeated sint64   repeated_sint64   = 95  [packed = true];
175  repeated fixed32  repeated_fixed32  = 96  [packed = true];
176  repeated fixed64  repeated_fixed64  = 97  [packed = true];
177  repeated sfixed32 repeated_sfixed32 = 98  [packed = true];
178  repeated sfixed64 repeated_sfixed64 = 99  [packed = true];
179  repeated float    repeated_float    = 100 [packed = true];
180  repeated double   repeated_double   = 101 [packed = true];
181  repeated bool     repeated_bool     = 102 [packed = true];
182  repeated TestEnum repeated_enum     = 103 [packed = true];
183}
184
185// Need to be in sync with TestPackedMessage.
186message TestUnpackedMessage {
187  repeated int32    repeated_int32    = 90  [packed = false];
188  repeated int64    repeated_int64    = 91  [packed = false];
189  repeated uint32   repeated_uint32   = 92  [packed = false];
190  repeated uint64   repeated_uint64   = 93  [packed = false];
191  repeated sint32   repeated_sint32   = 94  [packed = false];
192  repeated sint64   repeated_sint64   = 95  [packed = false];
193  repeated fixed32  repeated_fixed32  = 96  [packed = false];
194  repeated fixed64  repeated_fixed64  = 97  [packed = false];
195  repeated sfixed32 repeated_sfixed32 = 98  [packed = false];
196  repeated sfixed64 repeated_sfixed64 = 99  [packed = false];
197  repeated float    repeated_float    = 100 [packed = false];
198  repeated double   repeated_double   = 101 [packed = false];
199  repeated bool     repeated_bool     = 102 [packed = false];
200  repeated TestEnum repeated_enum     = 103 [packed = false];
201}
202
203// /**/@<>&\{
204message TestPhpDoc {
205  int32 a = 1;
206}
207
208message TestIncludePrefixMessage {
209  TestPrefix prefix_message = 1;
210}
211
212message TestIncludeNamespaceMessage {
213  TestNamespace namespace_message = 1;
214  TestEmptyNamespace empty_namespace_message = 2;
215}
216
217// This will cause upb fields not ordered by the order in the generated code.
218message TestRandomFieldOrder {
219  int64 tag13 = 150;
220  string tag14 = 160;
221}
222
223message TestReverseFieldOrder {
224  repeated int32 a = 2;
225  string b = 1;
226}
227
228message testLowerCaseMessage {
229}
230
231enum testLowerCaseEnum {
232  VALUE = 0;
233}
234
235message TestAny {
236  google.protobuf.Any any = 1;
237}
238
239message TestInt32Value {
240  google.protobuf.Int32Value field = 1;
241  repeated google.protobuf.Int32Value repeated_field = 2;
242  oneof oneof_fields {
243    google.protobuf.Int32Value oneof_field = 3;
244    int32 int32_field = 4;
245  }
246}
247
248message TestInt64Value {
249  google.protobuf.Int64Value field = 1;
250  repeated google.protobuf.Int64Value repeated_field = 2;
251  oneof oneof_fields {
252    google.protobuf.Int64Value oneof_field = 3;
253    int32 int32_field = 4;
254  }
255}
256
257message TestUInt32Value {
258  google.protobuf.UInt32Value field = 1;
259  repeated google.protobuf.UInt32Value repeated_field = 2;
260  oneof oneof_fields {
261    google.protobuf.UInt32Value oneof_field = 3;
262    int32 int32_field = 4;
263  }
264}
265
266message TestUInt64Value {
267  google.protobuf.UInt64Value field = 1;
268  repeated google.protobuf.UInt64Value repeated_field = 2;
269  oneof oneof_fields {
270    google.protobuf.UInt64Value oneof_field = 3;
271    int32 int32_field = 4;
272  }
273}
274
275message TestBoolValue {
276  google.protobuf.BoolValue field = 1;
277  repeated google.protobuf.BoolValue repeated_field = 2;
278  oneof oneof_fields {
279    google.protobuf.BoolValue oneof_field = 3;
280    int32 int32_field = 4;
281  }
282}
283
284message TestStringValue {
285  google.protobuf.StringValue field = 1;
286  repeated google.protobuf.StringValue repeated_field = 2;
287  oneof oneof_fields {
288    google.protobuf.StringValue oneof_field = 3;
289    int32 int32_field = 4;
290  }
291  map<int32, google.protobuf.StringValue> map_field = 5;
292}
293
294message TestBytesValue {
295  google.protobuf.BytesValue field = 1;
296  repeated google.protobuf.BytesValue repeated_field = 2;
297  oneof oneof_fields {
298    google.protobuf.BytesValue oneof_field = 3;
299    int32 int32_field = 4;
300  }
301}
302