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