1ffe3c632Sopenharmony_ci// Protocol Buffers - Google's data interchange format
2ffe3c632Sopenharmony_ci// Copyright 2008 Google Inc.  All rights reserved.
3ffe3c632Sopenharmony_ci// https://developers.google.com/protocol-buffers/
4ffe3c632Sopenharmony_ci//
5ffe3c632Sopenharmony_ci// Redistribution and use in source and binary forms, with or without
6ffe3c632Sopenharmony_ci// modification, are permitted provided that the following conditions are
7ffe3c632Sopenharmony_ci// met:
8ffe3c632Sopenharmony_ci//
9ffe3c632Sopenharmony_ci//     * Redistributions of source code must retain the above copyright
10ffe3c632Sopenharmony_ci// notice, this list of conditions and the following disclaimer.
11ffe3c632Sopenharmony_ci//     * Redistributions in binary form must reproduce the above
12ffe3c632Sopenharmony_ci// copyright notice, this list of conditions and the following disclaimer
13ffe3c632Sopenharmony_ci// in the documentation and/or other materials provided with the
14ffe3c632Sopenharmony_ci// distribution.
15ffe3c632Sopenharmony_ci//     * Neither the name of Google Inc. nor the names of its
16ffe3c632Sopenharmony_ci// contributors may be used to endorse or promote products derived from
17ffe3c632Sopenharmony_ci// this software without specific prior written permission.
18ffe3c632Sopenharmony_ci//
19ffe3c632Sopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20ffe3c632Sopenharmony_ci// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21ffe3c632Sopenharmony_ci// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22ffe3c632Sopenharmony_ci// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23ffe3c632Sopenharmony_ci// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24ffe3c632Sopenharmony_ci// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25ffe3c632Sopenharmony_ci// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26ffe3c632Sopenharmony_ci// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27ffe3c632Sopenharmony_ci// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28ffe3c632Sopenharmony_ci// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29ffe3c632Sopenharmony_ci// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30ffe3c632Sopenharmony_ci
31ffe3c632Sopenharmony_ci// LINT: ALLOW_GROUPS
32ffe3c632Sopenharmony_ci
33ffe3c632Sopenharmony_cisyntax = "proto2";
34ffe3c632Sopenharmony_ci
35ffe3c632Sopenharmony_ci
36ffe3c632Sopenharmony_cipackage jspb.test;
37ffe3c632Sopenharmony_ci
38ffe3c632Sopenharmony_ci// These types are borrowed from `unittest.proto` in the protobuf tree. We want
39ffe3c632Sopenharmony_ci// to ensure that the binary-format support will handle all field types
40ffe3c632Sopenharmony_ci// properly.
41ffe3c632Sopenharmony_cimessage TestAllTypes {
42ffe3c632Sopenharmony_ci  optional int32 optional_int32 = 1;
43ffe3c632Sopenharmony_ci  optional int64 optional_int64 = 2;
44ffe3c632Sopenharmony_ci  optional uint32 optional_uint32 = 3;
45ffe3c632Sopenharmony_ci  optional uint64 optional_uint64 = 4;
46ffe3c632Sopenharmony_ci  optional sint32 optional_sint32 = 5;
47ffe3c632Sopenharmony_ci  optional sint64 optional_sint64 = 6;
48ffe3c632Sopenharmony_ci  optional fixed32 optional_fixed32 = 7;
49ffe3c632Sopenharmony_ci  optional fixed64 optional_fixed64 = 8;
50ffe3c632Sopenharmony_ci  optional sfixed32 optional_sfixed32 = 9;
51ffe3c632Sopenharmony_ci  optional sfixed64 optional_sfixed64 = 10;
52ffe3c632Sopenharmony_ci  optional float optional_float = 11;
53ffe3c632Sopenharmony_ci  optional double optional_double = 12;
54ffe3c632Sopenharmony_ci  optional bool optional_bool = 13;
55ffe3c632Sopenharmony_ci  optional string optional_string = 14;
56ffe3c632Sopenharmony_ci  optional bytes optional_bytes = 15;
57ffe3c632Sopenharmony_ci  optional group OptionalGroup = 16 {
58ffe3c632Sopenharmony_ci    optional int32 a = 17;
59ffe3c632Sopenharmony_ci  }
60ffe3c632Sopenharmony_ci
61ffe3c632Sopenharmony_ci  optional ForeignMessage optional_foreign_message = 19;
62ffe3c632Sopenharmony_ci  optional ForeignEnum optional_foreign_enum = 22;
63ffe3c632Sopenharmony_ci
64ffe3c632Sopenharmony_ci  // Repeated
65ffe3c632Sopenharmony_ci  repeated int32 repeated_int32 = 31;
66ffe3c632Sopenharmony_ci  repeated int64 repeated_int64 = 32;
67ffe3c632Sopenharmony_ci  repeated uint32 repeated_uint32 = 33;
68ffe3c632Sopenharmony_ci  repeated uint64 repeated_uint64 = 34;
69ffe3c632Sopenharmony_ci  repeated sint32 repeated_sint32 = 35;
70ffe3c632Sopenharmony_ci  repeated sint64 repeated_sint64 = 36;
71ffe3c632Sopenharmony_ci  repeated fixed32 repeated_fixed32 = 37;
72ffe3c632Sopenharmony_ci  repeated fixed64 repeated_fixed64 = 38;
73ffe3c632Sopenharmony_ci  repeated sfixed32 repeated_sfixed32 = 39;
74ffe3c632Sopenharmony_ci  repeated sfixed64 repeated_sfixed64 = 40;
75ffe3c632Sopenharmony_ci  repeated float repeated_float = 41;
76ffe3c632Sopenharmony_ci  repeated double repeated_double = 42;
77ffe3c632Sopenharmony_ci  repeated bool repeated_bool = 43;
78ffe3c632Sopenharmony_ci  repeated string repeated_string = 44;
79ffe3c632Sopenharmony_ci  repeated bytes repeated_bytes = 45;
80ffe3c632Sopenharmony_ci
81ffe3c632Sopenharmony_ci  repeated group RepeatedGroup = 46 {
82ffe3c632Sopenharmony_ci    optional int32 a = 47;
83ffe3c632Sopenharmony_ci  }
84ffe3c632Sopenharmony_ci
85ffe3c632Sopenharmony_ci  repeated ForeignMessage repeated_foreign_message = 49;
86ffe3c632Sopenharmony_ci  repeated ForeignEnum repeated_foreign_enum = 52;
87ffe3c632Sopenharmony_ci
88ffe3c632Sopenharmony_ci  // Packed repeated
89ffe3c632Sopenharmony_ci  repeated int32 packed_repeated_int32 = 61 [packed = true];
90ffe3c632Sopenharmony_ci  repeated int64 packed_repeated_int64 = 62 [packed = true];
91ffe3c632Sopenharmony_ci  repeated uint32 packed_repeated_uint32 = 63 [packed = true];
92ffe3c632Sopenharmony_ci  repeated uint64 packed_repeated_uint64 = 64 [packed = true];
93ffe3c632Sopenharmony_ci  repeated sint32 packed_repeated_sint32 = 65 [packed = true];
94ffe3c632Sopenharmony_ci  repeated sint64 packed_repeated_sint64 = 66 [packed = true];
95ffe3c632Sopenharmony_ci  repeated fixed32 packed_repeated_fixed32 = 67 [packed = true];
96ffe3c632Sopenharmony_ci  repeated fixed64 packed_repeated_fixed64 = 68 [packed = true];
97ffe3c632Sopenharmony_ci  repeated sfixed32 packed_repeated_sfixed32 = 69 [packed = true];
98ffe3c632Sopenharmony_ci  repeated sfixed64 packed_repeated_sfixed64 = 70 [packed = true];
99ffe3c632Sopenharmony_ci  repeated float packed_repeated_float = 71 [packed = true];
100ffe3c632Sopenharmony_ci  repeated double packed_repeated_double = 72 [packed = true];
101ffe3c632Sopenharmony_ci  repeated bool packed_repeated_bool = 73 [packed = true];
102ffe3c632Sopenharmony_ci
103ffe3c632Sopenharmony_ci  oneof oneof_field {
104ffe3c632Sopenharmony_ci    uint32 oneof_uint32 = 111;
105ffe3c632Sopenharmony_ci    ForeignMessage oneof_foreign_message = 112;
106ffe3c632Sopenharmony_ci    string oneof_string = 113;
107ffe3c632Sopenharmony_ci    bytes oneof_bytes = 114;
108ffe3c632Sopenharmony_ci  }
109ffe3c632Sopenharmony_ci
110ffe3c632Sopenharmony_ci}
111ffe3c632Sopenharmony_ci
112ffe3c632Sopenharmony_cimessage ForeignMessage {
113ffe3c632Sopenharmony_ci  optional int32 c = 1;
114ffe3c632Sopenharmony_ci}
115ffe3c632Sopenharmony_ci
116ffe3c632Sopenharmony_cienum ForeignEnum {
117ffe3c632Sopenharmony_ci  FOREIGN_FOO = 4;
118ffe3c632Sopenharmony_ci  FOREIGN_BAR = 5;
119ffe3c632Sopenharmony_ci  FOREIGN_BAZ = 6;
120ffe3c632Sopenharmony_ci}
121ffe3c632Sopenharmony_ci
122ffe3c632Sopenharmony_cimessage TestExtendable {
123ffe3c632Sopenharmony_ci  extensions 1 to max;
124ffe3c632Sopenharmony_ci}
125ffe3c632Sopenharmony_ci
126ffe3c632Sopenharmony_cimessage ExtendsWithMessage {
127ffe3c632Sopenharmony_ci  extend TestExtendable {
128ffe3c632Sopenharmony_ci    optional ExtendsWithMessage optional_extension = 19;
129ffe3c632Sopenharmony_ci    repeated ExtendsWithMessage repeated_extension = 49;
130ffe3c632Sopenharmony_ci  }
131ffe3c632Sopenharmony_ci  optional int32 foo = 1;
132ffe3c632Sopenharmony_ci}
133ffe3c632Sopenharmony_ci
134ffe3c632Sopenharmony_ciextend TestExtendable {
135ffe3c632Sopenharmony_ci  optional int32 extend_optional_int32 = 1;
136ffe3c632Sopenharmony_ci  optional int64 extend_optional_int64 = 2;
137ffe3c632Sopenharmony_ci  optional uint32 extend_optional_uint32 = 3;
138ffe3c632Sopenharmony_ci  optional uint64 extend_optional_uint64 = 4;
139ffe3c632Sopenharmony_ci  optional sint32 extend_optional_sint32 = 5;
140ffe3c632Sopenharmony_ci  optional sint64 extend_optional_sint64 = 6;
141ffe3c632Sopenharmony_ci  optional fixed32 extend_optional_fixed32 = 7;
142ffe3c632Sopenharmony_ci  optional fixed64 extend_optional_fixed64 = 8;
143ffe3c632Sopenharmony_ci  optional sfixed32 extend_optional_sfixed32 = 9;
144ffe3c632Sopenharmony_ci  optional sfixed64 extend_optional_sfixed64 = 10;
145ffe3c632Sopenharmony_ci  optional float extend_optional_float = 11;
146ffe3c632Sopenharmony_ci  optional double extend_optional_double = 12;
147ffe3c632Sopenharmony_ci  optional bool extend_optional_bool = 13;
148ffe3c632Sopenharmony_ci  optional string extend_optional_string = 14;
149ffe3c632Sopenharmony_ci  optional bytes extend_optional_bytes = 15;
150ffe3c632Sopenharmony_ci  optional ForeignEnum extend_optional_foreign_enum = 22;
151ffe3c632Sopenharmony_ci
152ffe3c632Sopenharmony_ci  repeated int32 extend_repeated_int32 = 31;
153ffe3c632Sopenharmony_ci  repeated int64 extend_repeated_int64 = 32;
154ffe3c632Sopenharmony_ci  repeated uint32 extend_repeated_uint32 = 33;
155ffe3c632Sopenharmony_ci  repeated uint64 extend_repeated_uint64 = 34;
156ffe3c632Sopenharmony_ci  repeated sint32 extend_repeated_sint32 = 35;
157ffe3c632Sopenharmony_ci  repeated sint64 extend_repeated_sint64 = 36;
158ffe3c632Sopenharmony_ci  repeated fixed32 extend_repeated_fixed32 = 37;
159ffe3c632Sopenharmony_ci  repeated fixed64 extend_repeated_fixed64 = 38;
160ffe3c632Sopenharmony_ci  repeated sfixed32 extend_repeated_sfixed32 = 39;
161ffe3c632Sopenharmony_ci  repeated sfixed64 extend_repeated_sfixed64 = 40;
162ffe3c632Sopenharmony_ci  repeated float extend_repeated_float = 41;
163ffe3c632Sopenharmony_ci  repeated double extend_repeated_double = 42;
164ffe3c632Sopenharmony_ci  repeated bool extend_repeated_bool = 43;
165ffe3c632Sopenharmony_ci  repeated string extend_repeated_string = 44;
166ffe3c632Sopenharmony_ci  repeated bytes extend_repeated_bytes = 45;
167ffe3c632Sopenharmony_ci  repeated ForeignEnum extend_repeated_foreign_enum = 52;
168ffe3c632Sopenharmony_ci
169ffe3c632Sopenharmony_ci  repeated int32 extend_packed_repeated_int32 = 61 [packed = true];
170ffe3c632Sopenharmony_ci  repeated int64 extend_packed_repeated_int64 = 62 [packed = true];
171ffe3c632Sopenharmony_ci  repeated uint32 extend_packed_repeated_uint32 = 63 [packed = true];
172ffe3c632Sopenharmony_ci  repeated uint64 extend_packed_repeated_uint64 = 64 [packed = true];
173ffe3c632Sopenharmony_ci  repeated sint32 extend_packed_repeated_sint32 = 65 [packed = true];
174ffe3c632Sopenharmony_ci  repeated sint64 extend_packed_repeated_sint64 = 66 [packed = true];
175ffe3c632Sopenharmony_ci  repeated fixed32 extend_packed_repeated_fixed32 = 67 [packed = true];
176ffe3c632Sopenharmony_ci  repeated fixed64 extend_packed_repeated_fixed64 = 68 [packed = true];
177ffe3c632Sopenharmony_ci  repeated sfixed32 extend_packed_repeated_sfixed32 = 69 [packed = true];
178ffe3c632Sopenharmony_ci  repeated sfixed64 extend_packed_repeated_sfixed64 = 70 [packed = true];
179ffe3c632Sopenharmony_ci  repeated float extend_packed_repeated_float = 71 [packed = true];
180ffe3c632Sopenharmony_ci  repeated double extend_packed_repeated_double = 72 [packed = true];
181ffe3c632Sopenharmony_ci  repeated bool extend_packed_repeated_bool = 73 [packed = true];
182ffe3c632Sopenharmony_ci  repeated ForeignEnum extend_packed_repeated_foreign_enum = 82 [packed = true];
183ffe3c632Sopenharmony_ci
184ffe3c632Sopenharmony_ci}
185ffe3c632Sopenharmony_ci
186ffe3c632Sopenharmony_cimessage TestMapFields {
187ffe3c632Sopenharmony_ci  map<string, string> map_string_string = 1;
188ffe3c632Sopenharmony_ci  map<string, int32> map_string_int32 = 2;
189ffe3c632Sopenharmony_ci  map<string, int64> map_string_int64 = 3;
190ffe3c632Sopenharmony_ci  map<string, bool> map_string_bool = 4;
191ffe3c632Sopenharmony_ci  map<string, double> map_string_double = 5;
192ffe3c632Sopenharmony_ci  map<string, MapValueEnum> map_string_enum = 6;
193ffe3c632Sopenharmony_ci  map<string, MapValueMessage> map_string_msg = 7;
194ffe3c632Sopenharmony_ci
195ffe3c632Sopenharmony_ci  map<int32, string> map_int32_string = 8;
196ffe3c632Sopenharmony_ci  map<int64, string> map_int64_string = 9;
197ffe3c632Sopenharmony_ci  map<bool, string> map_bool_string = 10;
198ffe3c632Sopenharmony_ci
199ffe3c632Sopenharmony_ci  optional TestMapFields test_map_fields = 11;
200ffe3c632Sopenharmony_ci  map<string, TestMapFields> map_string_testmapfields = 12;
201ffe3c632Sopenharmony_ci}
202ffe3c632Sopenharmony_ci
203ffe3c632Sopenharmony_ci// These proto are 'mock map' entries to test the above map deserializing with
204ffe3c632Sopenharmony_ci// undefined keys. Make sure TestMapFieldsOptionalKeys is written to be
205ffe3c632Sopenharmony_ci// deserialized by TestMapFields
206ffe3c632Sopenharmony_cimessage MapEntryOptionalKeysStringKey {
207ffe3c632Sopenharmony_ci  optional string key = 1;
208ffe3c632Sopenharmony_ci  optional string value = 2;
209ffe3c632Sopenharmony_ci}
210ffe3c632Sopenharmony_ci
211ffe3c632Sopenharmony_cimessage MapEntryOptionalKeysInt32Key {
212ffe3c632Sopenharmony_ci  optional int32 key = 1;
213ffe3c632Sopenharmony_ci  optional string value = 2;
214ffe3c632Sopenharmony_ci}
215ffe3c632Sopenharmony_ci
216ffe3c632Sopenharmony_cimessage MapEntryOptionalKeysInt64Key {
217ffe3c632Sopenharmony_ci  optional int64 key = 1;
218ffe3c632Sopenharmony_ci  optional string value = 2;
219ffe3c632Sopenharmony_ci}
220ffe3c632Sopenharmony_ci
221ffe3c632Sopenharmony_cimessage MapEntryOptionalKeysBoolKey {
222ffe3c632Sopenharmony_ci  optional bool key = 1;
223ffe3c632Sopenharmony_ci  optional string value = 2;
224ffe3c632Sopenharmony_ci}
225ffe3c632Sopenharmony_ci
226ffe3c632Sopenharmony_cimessage TestMapFieldsOptionalKeys {
227ffe3c632Sopenharmony_ci  optional MapEntryOptionalKeysStringKey map_string_string = 1;
228ffe3c632Sopenharmony_ci  optional MapEntryOptionalKeysInt32Key map_int32_string = 8;
229ffe3c632Sopenharmony_ci  optional MapEntryOptionalKeysInt64Key map_int64_string = 9;
230ffe3c632Sopenharmony_ci  optional MapEntryOptionalKeysBoolKey map_bool_string = 10;
231ffe3c632Sopenharmony_ci}
232ffe3c632Sopenharmony_ci
233ffe3c632Sopenharmony_ci// End mock-map entries
234ffe3c632Sopenharmony_ci
235ffe3c632Sopenharmony_ci// These proto are 'mock map' entries to test the above map deserializing with
236ffe3c632Sopenharmony_ci// undefined values. Make sure TestMapFieldsOptionalValues is written to be
237ffe3c632Sopenharmony_ci// deserialized by TestMapFields
238ffe3c632Sopenharmony_cimessage MapEntryOptionalValuesStringValue {
239ffe3c632Sopenharmony_ci  optional string key = 1;
240ffe3c632Sopenharmony_ci  optional string value = 2;
241ffe3c632Sopenharmony_ci}
242ffe3c632Sopenharmony_ci
243ffe3c632Sopenharmony_cimessage MapEntryOptionalValuesInt32Value {
244ffe3c632Sopenharmony_ci  optional string key = 1;
245ffe3c632Sopenharmony_ci  optional int32 value = 2;
246ffe3c632Sopenharmony_ci}
247ffe3c632Sopenharmony_ci
248ffe3c632Sopenharmony_cimessage MapEntryOptionalValuesInt64Value {
249ffe3c632Sopenharmony_ci  optional string key = 1;
250ffe3c632Sopenharmony_ci  optional int64 value = 2;
251ffe3c632Sopenharmony_ci}
252ffe3c632Sopenharmony_ci
253ffe3c632Sopenharmony_cimessage MapEntryOptionalValuesBoolValue {
254ffe3c632Sopenharmony_ci  optional string key = 1;
255ffe3c632Sopenharmony_ci  optional bool value = 2;
256ffe3c632Sopenharmony_ci}
257ffe3c632Sopenharmony_ci
258ffe3c632Sopenharmony_cimessage MapEntryOptionalValuesDoubleValue {
259ffe3c632Sopenharmony_ci  optional string key = 1;
260ffe3c632Sopenharmony_ci  optional double value = 2;
261ffe3c632Sopenharmony_ci}
262ffe3c632Sopenharmony_ci
263ffe3c632Sopenharmony_cimessage MapEntryOptionalValuesEnumValue {
264ffe3c632Sopenharmony_ci  optional string key = 1;
265ffe3c632Sopenharmony_ci  optional MapValueEnum value = 2;
266ffe3c632Sopenharmony_ci}
267ffe3c632Sopenharmony_ci
268ffe3c632Sopenharmony_cimessage MapEntryOptionalValuesMessageValue {
269ffe3c632Sopenharmony_ci  optional string key = 1;
270ffe3c632Sopenharmony_ci  optional MapValueMessage value = 2;
271ffe3c632Sopenharmony_ci}
272ffe3c632Sopenharmony_ci
273ffe3c632Sopenharmony_cimessage TestMapFieldsOptionalValues {
274ffe3c632Sopenharmony_ci  optional MapEntryOptionalValuesStringValue map_string_string = 1;
275ffe3c632Sopenharmony_ci  optional MapEntryOptionalValuesInt32Value map_string_int32 = 2;
276ffe3c632Sopenharmony_ci  optional MapEntryOptionalValuesInt64Value map_string_int64 = 3;
277ffe3c632Sopenharmony_ci  optional MapEntryOptionalValuesBoolValue map_string_bool = 4;
278ffe3c632Sopenharmony_ci  optional MapEntryOptionalValuesDoubleValue map_string_double = 5;
279ffe3c632Sopenharmony_ci  optional MapEntryOptionalValuesEnumValue map_string_enum = 6;
280ffe3c632Sopenharmony_ci  optional MapEntryOptionalValuesMessageValue map_string_msg = 7;
281ffe3c632Sopenharmony_ci}
282ffe3c632Sopenharmony_ci
283ffe3c632Sopenharmony_ci// End mock-map entries
284ffe3c632Sopenharmony_ci
285ffe3c632Sopenharmony_cienum MapValueEnum {
286ffe3c632Sopenharmony_ci  MAP_VALUE_FOO = 0;
287ffe3c632Sopenharmony_ci  MAP_VALUE_BAR = 1;
288ffe3c632Sopenharmony_ci  MAP_VALUE_BAZ = 2;
289ffe3c632Sopenharmony_ci}
290ffe3c632Sopenharmony_ci
291ffe3c632Sopenharmony_cimessage MapValueMessage {
292ffe3c632Sopenharmony_ci  optional int32 foo = 1;
293ffe3c632Sopenharmony_ci}
294ffe3c632Sopenharmony_ci
295