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// Author: mwr@google.com (Mark Rawling)
32ffe3c632Sopenharmony_ci
33ffe3c632Sopenharmony_cisyntax = "proto2";
34ffe3c632Sopenharmony_ci
35ffe3c632Sopenharmony_cioption java_package = "com.google.apps.jspb.proto";
36ffe3c632Sopenharmony_cioption java_multiple_files = true;
37ffe3c632Sopenharmony_ci
38ffe3c632Sopenharmony_ciimport "google/protobuf/descriptor.proto";
39ffe3c632Sopenharmony_ci
40ffe3c632Sopenharmony_cipackage jspb.test;
41ffe3c632Sopenharmony_ci
42ffe3c632Sopenharmony_cimessage Empty {
43ffe3c632Sopenharmony_ci}
44ffe3c632Sopenharmony_ci
45ffe3c632Sopenharmony_cienum OuterEnum {
46ffe3c632Sopenharmony_ci  FOO = 1;
47ffe3c632Sopenharmony_ci  BAR = 2;
48ffe3c632Sopenharmony_ci}
49ffe3c632Sopenharmony_ci
50ffe3c632Sopenharmony_cimessage EnumContainer {
51ffe3c632Sopenharmony_ci  optional OuterEnum outer_enum = 1;
52ffe3c632Sopenharmony_ci}
53ffe3c632Sopenharmony_ci
54ffe3c632Sopenharmony_cimessage Simple1 {
55ffe3c632Sopenharmony_ci  required string a_string = 1;
56ffe3c632Sopenharmony_ci  repeated string a_repeated_string = 2;
57ffe3c632Sopenharmony_ci  optional bool a_boolean = 3;
58ffe3c632Sopenharmony_ci}
59ffe3c632Sopenharmony_ci
60ffe3c632Sopenharmony_ci// A message that differs from Simple1 only by name
61ffe3c632Sopenharmony_cimessage Simple2 {
62ffe3c632Sopenharmony_ci  required string a_string = 1;
63ffe3c632Sopenharmony_ci  repeated string a_repeated_string = 2;
64ffe3c632Sopenharmony_ci}
65ffe3c632Sopenharmony_ci
66ffe3c632Sopenharmony_cimessage SpecialCases {
67ffe3c632Sopenharmony_ci  required string normal = 1;
68ffe3c632Sopenharmony_ci  // Examples of Js reserved names that are converted to pb_<name>.
69ffe3c632Sopenharmony_ci  required string default = 2;
70ffe3c632Sopenharmony_ci  required string function = 3;
71ffe3c632Sopenharmony_ci  required string var = 4;
72ffe3c632Sopenharmony_ci}
73ffe3c632Sopenharmony_ci
74ffe3c632Sopenharmony_cimessage OptionalFields {
75ffe3c632Sopenharmony_ci  message Nested {
76ffe3c632Sopenharmony_ci    optional int32 an_int = 1;
77ffe3c632Sopenharmony_ci  }
78ffe3c632Sopenharmony_ci  optional string a_string = 1;
79ffe3c632Sopenharmony_ci  required bool a_bool = 2;
80ffe3c632Sopenharmony_ci  optional Nested a_nested_message = 3;
81ffe3c632Sopenharmony_ci  repeated Nested a_repeated_message = 4;
82ffe3c632Sopenharmony_ci  repeated string a_repeated_string = 5;
83ffe3c632Sopenharmony_ci}
84ffe3c632Sopenharmony_ci
85ffe3c632Sopenharmony_cimessage HasExtensions {
86ffe3c632Sopenharmony_ci  optional string str1 = 1;
87ffe3c632Sopenharmony_ci  optional string str2 = 2;
88ffe3c632Sopenharmony_ci  optional string str3 = 3;
89ffe3c632Sopenharmony_ci  extensions 10 to max;
90ffe3c632Sopenharmony_ci}
91ffe3c632Sopenharmony_ci
92ffe3c632Sopenharmony_cimessage Complex {
93ffe3c632Sopenharmony_ci  message Nested {
94ffe3c632Sopenharmony_ci    required int32 an_int = 2;
95ffe3c632Sopenharmony_ci  }
96ffe3c632Sopenharmony_ci  required string a_string = 1;
97ffe3c632Sopenharmony_ci  required bool an_out_of_order_bool = 9;
98ffe3c632Sopenharmony_ci  optional Nested a_nested_message = 4;
99ffe3c632Sopenharmony_ci  repeated Nested a_repeated_message = 5;
100ffe3c632Sopenharmony_ci  repeated string a_repeated_string = 7;
101ffe3c632Sopenharmony_ci}
102ffe3c632Sopenharmony_ci
103ffe3c632Sopenharmony_cimessage OuterMessage {
104ffe3c632Sopenharmony_ci  // Make sure this doesn't conflict with the other Complex message.
105ffe3c632Sopenharmony_ci  message Complex {
106ffe3c632Sopenharmony_ci    optional int32 inner_complex_field = 1;
107ffe3c632Sopenharmony_ci  }
108ffe3c632Sopenharmony_ci}
109ffe3c632Sopenharmony_ci
110ffe3c632Sopenharmony_cimessage IsExtension {
111ffe3c632Sopenharmony_ci  extend HasExtensions {
112ffe3c632Sopenharmony_ci    optional IsExtension ext_field = 100;
113ffe3c632Sopenharmony_ci  }
114ffe3c632Sopenharmony_ci  optional string ext1 = 1;
115ffe3c632Sopenharmony_ci
116ffe3c632Sopenharmony_ci  // Extensions of proto2 Descriptor messages will be ignored.
117ffe3c632Sopenharmony_ci  extend google.protobuf.EnumOptions {
118ffe3c632Sopenharmony_ci    optional string simple_option = 42113038;
119ffe3c632Sopenharmony_ci  }
120ffe3c632Sopenharmony_ci}
121ffe3c632Sopenharmony_ci
122ffe3c632Sopenharmony_cimessage IndirectExtension {
123ffe3c632Sopenharmony_ci  extend HasExtensions {
124ffe3c632Sopenharmony_ci    optional Simple1 simple = 101;
125ffe3c632Sopenharmony_ci    optional string str = 102;
126ffe3c632Sopenharmony_ci    repeated string repeated_str = 103;
127ffe3c632Sopenharmony_ci    repeated Simple1 repeated_simple = 104;
128ffe3c632Sopenharmony_ci  }
129ffe3c632Sopenharmony_ci}
130ffe3c632Sopenharmony_ci
131ffe3c632Sopenharmony_ciextend HasExtensions {
132ffe3c632Sopenharmony_ci  optional Simple1 simple1 = 105;
133ffe3c632Sopenharmony_ci}
134ffe3c632Sopenharmony_ci
135ffe3c632Sopenharmony_cimessage DefaultValues {
136ffe3c632Sopenharmony_ci  enum Enum {
137ffe3c632Sopenharmony_ci    E1 = 13;
138ffe3c632Sopenharmony_ci    E2 = 77;
139ffe3c632Sopenharmony_ci  }
140ffe3c632Sopenharmony_ci  optional string string_field = 1 [default="default<>\'\"abc"];
141ffe3c632Sopenharmony_ci  optional bool bool_field = 2 [default=true];
142ffe3c632Sopenharmony_ci  optional int64 int_field = 3 [default=11];
143ffe3c632Sopenharmony_ci  optional Enum enum_field = 4 [default=E1];
144ffe3c632Sopenharmony_ci  optional string empty_field = 6 [default=""];
145ffe3c632Sopenharmony_ci  optional bytes bytes_field = 8 [default="moo"]; // Base64 encoding is "bW9v"
146ffe3c632Sopenharmony_ci}
147ffe3c632Sopenharmony_ci
148ffe3c632Sopenharmony_cimessage FloatingPointFields {
149ffe3c632Sopenharmony_ci  optional float optional_float_field = 1;
150ffe3c632Sopenharmony_ci  required float required_float_field = 2;
151ffe3c632Sopenharmony_ci  repeated float repeated_float_field = 3;
152ffe3c632Sopenharmony_ci  optional float default_float_field = 4 [default = 2.0];
153ffe3c632Sopenharmony_ci  optional double optional_double_field = 5;
154ffe3c632Sopenharmony_ci  required double required_double_field = 6;
155ffe3c632Sopenharmony_ci  repeated double repeated_double_field = 7;
156ffe3c632Sopenharmony_ci  optional double default_double_field = 8 [default = 2.0];
157ffe3c632Sopenharmony_ci}
158ffe3c632Sopenharmony_ci
159ffe3c632Sopenharmony_cimessage TestClone {
160ffe3c632Sopenharmony_ci  optional string str = 1;
161ffe3c632Sopenharmony_ci  optional Simple1 simple1 = 3;
162ffe3c632Sopenharmony_ci  repeated Simple1 simple2 = 5;
163ffe3c632Sopenharmony_ci  optional bytes bytes_field = 6;
164ffe3c632Sopenharmony_ci  optional string unused = 7;
165ffe3c632Sopenharmony_ci  extensions 10 to max;
166ffe3c632Sopenharmony_ci}
167ffe3c632Sopenharmony_ci
168ffe3c632Sopenharmony_cimessage CloneExtension {
169ffe3c632Sopenharmony_ci  extend TestClone {
170ffe3c632Sopenharmony_ci    optional CloneExtension ext_field = 100;
171ffe3c632Sopenharmony_ci  }
172ffe3c632Sopenharmony_ci  optional string ext = 2;
173ffe3c632Sopenharmony_ci}
174ffe3c632Sopenharmony_ci
175ffe3c632Sopenharmony_cimessage TestGroup {
176ffe3c632Sopenharmony_ci  repeated group RepeatedGroup = 1 {
177ffe3c632Sopenharmony_ci    required string id = 1;
178ffe3c632Sopenharmony_ci    repeated bool some_bool = 2;
179ffe3c632Sopenharmony_ci  }
180ffe3c632Sopenharmony_ci  required group RequiredGroup = 2 {
181ffe3c632Sopenharmony_ci    required string id = 1;
182ffe3c632Sopenharmony_ci  }
183ffe3c632Sopenharmony_ci  optional group OptionalGroup = 3 {
184ffe3c632Sopenharmony_ci    required string id = 1;
185ffe3c632Sopenharmony_ci  }
186ffe3c632Sopenharmony_ci  optional string id = 4;
187ffe3c632Sopenharmony_ci  required Simple2 required_simple = 5;
188ffe3c632Sopenharmony_ci  optional Simple2 optional_simple = 6;
189ffe3c632Sopenharmony_ci}
190ffe3c632Sopenharmony_ci
191ffe3c632Sopenharmony_cimessage TestGroup1 {
192ffe3c632Sopenharmony_ci  optional TestGroup.RepeatedGroup group = 1;
193ffe3c632Sopenharmony_ci}
194ffe3c632Sopenharmony_ci
195ffe3c632Sopenharmony_cimessage TestReservedNames {
196ffe3c632Sopenharmony_ci  optional int32 extension = 1;
197ffe3c632Sopenharmony_ci  extensions 10 to max;
198ffe3c632Sopenharmony_ci}
199ffe3c632Sopenharmony_ci
200ffe3c632Sopenharmony_cimessage TestReservedNamesExtension {
201ffe3c632Sopenharmony_ci  extend TestReservedNames {
202ffe3c632Sopenharmony_ci    optional int32 foo = 10;
203ffe3c632Sopenharmony_ci  }
204ffe3c632Sopenharmony_ci}
205ffe3c632Sopenharmony_ci
206ffe3c632Sopenharmony_cimessage TestMessageWithOneof {
207ffe3c632Sopenharmony_ci
208ffe3c632Sopenharmony_ci  oneof partial_oneof {
209ffe3c632Sopenharmony_ci    string pone = 3;
210ffe3c632Sopenharmony_ci    string pthree = 5;
211ffe3c632Sopenharmony_ci  }
212ffe3c632Sopenharmony_ci
213ffe3c632Sopenharmony_ci  oneof recursive_oneof {
214ffe3c632Sopenharmony_ci    TestMessageWithOneof rone = 6;
215ffe3c632Sopenharmony_ci    string rtwo = 7;
216ffe3c632Sopenharmony_ci  }
217ffe3c632Sopenharmony_ci
218ffe3c632Sopenharmony_ci  optional bool normal_field = 8;
219ffe3c632Sopenharmony_ci  repeated string repeated_field = 9;
220ffe3c632Sopenharmony_ci
221ffe3c632Sopenharmony_ci  oneof default_oneof_a {
222ffe3c632Sopenharmony_ci    int32 aone = 10 [default = 1234];
223ffe3c632Sopenharmony_ci    int32 atwo = 11;
224ffe3c632Sopenharmony_ci  }
225ffe3c632Sopenharmony_ci
226ffe3c632Sopenharmony_ci  oneof default_oneof_b {
227ffe3c632Sopenharmony_ci    int32 bone = 12;
228ffe3c632Sopenharmony_ci    int32 btwo = 13 [default = 1234];
229ffe3c632Sopenharmony_ci  }
230ffe3c632Sopenharmony_ci}
231ffe3c632Sopenharmony_ci
232ffe3c632Sopenharmony_cimessage TestEndsWithBytes {
233ffe3c632Sopenharmony_ci  optional int32 value = 1;
234ffe3c632Sopenharmony_ci  optional bytes data = 2;
235ffe3c632Sopenharmony_ci}
236ffe3c632Sopenharmony_ci
237ffe3c632Sopenharmony_cimessage TestMapFieldsNoBinary {
238ffe3c632Sopenharmony_ci  map<string, string> map_string_string = 1;
239ffe3c632Sopenharmony_ci  map<string, int32> map_string_int32 = 2;
240ffe3c632Sopenharmony_ci  map<string, int64> map_string_int64 = 3;
241ffe3c632Sopenharmony_ci  map<string, bool> map_string_bool = 4;
242ffe3c632Sopenharmony_ci  map<string, double> map_string_double = 5;
243ffe3c632Sopenharmony_ci  map<string, MapValueEnumNoBinary> map_string_enum = 6;
244ffe3c632Sopenharmony_ci  map<string, MapValueMessageNoBinary> map_string_msg = 7;
245ffe3c632Sopenharmony_ci
246ffe3c632Sopenharmony_ci  map<int32, string> map_int32_string = 8;
247ffe3c632Sopenharmony_ci  map<int64, string> map_int64_string = 9;
248ffe3c632Sopenharmony_ci  map<bool, string> map_bool_string = 10;
249ffe3c632Sopenharmony_ci
250ffe3c632Sopenharmony_ci  optional TestMapFieldsNoBinary test_map_fields = 11;
251ffe3c632Sopenharmony_ci  map<string, TestMapFieldsNoBinary> map_string_testmapfields = 12;
252ffe3c632Sopenharmony_ci}
253ffe3c632Sopenharmony_ci
254ffe3c632Sopenharmony_cienum MapValueEnumNoBinary {
255ffe3c632Sopenharmony_ci  MAP_VALUE_FOO_NOBINARY = 0;
256ffe3c632Sopenharmony_ci  MAP_VALUE_BAR_NOBINARY = 1;
257ffe3c632Sopenharmony_ci  MAP_VALUE_BAZ_NOBINARY = 2;
258ffe3c632Sopenharmony_ci}
259ffe3c632Sopenharmony_ci
260ffe3c632Sopenharmony_cimessage MapValueMessageNoBinary {
261ffe3c632Sopenharmony_ci  optional int32 foo = 1;
262ffe3c632Sopenharmony_ci}
263