1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 // Author: mwr@google.com (Mark Rawling)
35 option java_package = "com.google.apps.jspb.proto";
36 option java_multiple_files = true;
38 import "google/protobuf/descriptor.proto";
49 message EnumContainer {
50 optional OuterEnum outer_enum = 1;
54 required string a_string = 1;
55 repeated string a_repeated_string = 2;
56 optional bool a_boolean = 3;
59 // A message that differs from Simple1 only by name
61 required string a_string = 1;
62 repeated string a_repeated_string = 2;
65 message SpecialCases {
66 required string normal = 1;
67 // Examples of Js reserved names that are converted to pb_<name>.
68 required string default = 2;
69 required string function = 3;
70 required string var = 4;
73 message OptionalFields {
75 optional int32 an_int = 1;
77 optional string a_string = 1;
78 required bool a_bool = 2;
79 optional Nested a_nested_message = 3;
80 repeated Nested a_repeated_message = 4;
81 repeated string a_repeated_string = 5;
84 message HasExtensions {
85 optional string str1 = 1;
86 optional string str2 = 2;
87 optional string str3 = 3;
93 required int32 an_int = 2;
95 required string a_string = 1;
96 optional bool an_out_of_order_bool = 9;
97 optional Nested a_nested_message = 4;
98 repeated Nested a_repeated_message = 5;
99 repeated string a_repeated_string = 7;
100 optional double a_floating_point_field = 10;
103 message OuterMessage {
104 // Make sure this doesn't conflict with the other Complex message.
106 optional int32 inner_complex_field = 1;
111 // document.cookie is a banned property in a couple of conformance check
112 // configs at Google. Verify that having a field called cookie doesn't confuse
113 // the compiler and break the build.
114 optional string cookie = 1;
117 message IsExtension {
118 extend HasExtensions {
119 optional IsExtension ext_field = 100;
121 optional string ext1 = 1;
123 // Extensions of proto2 Descriptor messages will be ignored.
124 extend google.protobuf.EnumOptions {
125 optional string simple_option = 42113038;
129 message IndirectExtension {
130 extend HasExtensions {
131 optional Simple1 simple = 101;
132 optional string str = 102;
133 repeated string repeated_str = 103;
134 repeated Simple1 repeated_simple = 104;
138 extend HasExtensions {
139 optional Simple1 simple1 = 105;
142 message DefaultValues {
147 optional string string_field = 1 [default = "default<>\'\"abc"];
148 optional bool bool_field = 2 [default = true];
149 optional int64 int_field = 3 [default = 11];
150 optional Enum enum_field = 4 [default = E1];
151 optional string empty_field = 6 [default = ""];
152 optional bytes bytes_field = 8
153 [default = "moo"]; // Base64 encoding is "bW9v"
156 message FloatingPointFields {
157 optional float optional_float_field = 1;
158 required float required_float_field = 2;
159 repeated float repeated_float_field = 3;
160 optional float default_float_field = 4 [default = 2.0];
161 optional double optional_double_field = 5;
162 required double required_double_field = 6;
163 repeated double repeated_double_field = 7;
164 optional double default_double_field = 8 [default = 2.0];
167 message BooleanFields {
168 optional bool optional_boolean_field = 1;
169 required bool required_boolean_field = 2;
170 repeated bool repeated_boolean_field = 3;
171 optional bool default_boolean_field = 4 [default = true];
175 optional string str = 1;
176 optional Simple1 simple1 = 3;
177 repeated Simple1 simple2 = 5;
178 optional bytes bytes_field = 6;
179 optional string unused = 7;
180 extensions 10 to max;
183 message TestCloneExtension {
185 optional TestCloneExtension low_ext = 11;
187 optional int32 f = 1;
190 message CloneExtension {
192 optional CloneExtension ext_field = 100;
194 optional string ext = 2;
198 repeated group RepeatedGroup = 1 {
199 required string id = 1;
200 repeated bool some_bool = 2;
202 required group RequiredGroup = 2 {
203 required string id = 1;
205 optional group OptionalGroup = 3 {
206 required string id = 1;
208 optional string id = 4;
209 required Simple2 required_simple = 5;
210 optional Simple2 optional_simple = 6;
214 optional TestGroup.RepeatedGroup group = 1;
217 message TestReservedNames {
218 optional int32 extension = 1;
219 extensions 10 to max;
222 message TestReservedNamesExtension {
223 extend TestReservedNames {
224 optional int32 foo = 10;
228 message TestMessageWithOneof {
230 oneof partial_oneof {
235 oneof recursive_oneof {
236 TestMessageWithOneof rone = 6;
240 optional bool normal_field = 8;
241 repeated string repeated_field = 9;
243 oneof default_oneof_a {
244 int32 aone = 10 [default = 1234];
248 oneof default_oneof_b {
250 int32 btwo = 13 [default = 1234];
254 message TestEndsWithBytes {
255 optional int32 value = 1;
256 optional bytes data = 2;
259 // This message is for testing extension handling doesn't affect fields before
260 // pivot. Don't add new field to this message. See b/117298778 for more detail.
261 message TestLastFieldBeforePivot {
262 optional int32 last_field_before_pivot = 1;
263 extensions 100 to max;
266 extend TestLastFieldBeforePivot {
267 optional int32 extend_test_last_field_before_pivot_field = 101;
272 optional int64 int64_normal = 1 [jstype = JS_NORMAL];
273 optional sint64 int64_string = 2 [jstype = JS_STRING];
274 optional uint64 int64_number = 3 [jstype = JS_NUMBER];
278 message TestMapFieldsNoBinary {
279 map<string, string> map_string_string = 1;
280 map<string, int32> map_string_int32 = 2;
281 map<string, int64> map_string_int64 = 3;
282 map<string, bool> map_string_bool = 4;
283 map<string, double> map_string_double = 5;
284 map<string, MapValueEnumNoBinary> map_string_enum = 6;
285 map<string, MapValueMessageNoBinary> map_string_msg = 7;
287 map<int32, string> map_int32_string = 8;
288 map<int64, string> map_int64_string = 9;
289 map<bool, string> map_bool_string = 10;
291 optional TestMapFieldsNoBinary test_map_fields = 11;
292 map<string, TestMapFieldsNoBinary> map_string_testmapfields = 12;
295 enum MapValueEnumNoBinary {
296 MAP_VALUE_FOO_NOBINARY = 0;
297 MAP_VALUE_BAR_NOBINARY = 1;
298 MAP_VALUE_BAZ_NOBINARY = 2;
301 message MapValueMessageNoBinary {
302 optional int32 foo = 1;
308 optional int32 count = 1;