1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Author: mwr@google.com (Mark Rawling)
syntax = "proto2";
option java_package = "com.google.apps.jspb.proto";
option java_multiple_files = true;
import "google/protobuf/descriptor.proto";
package jspb.test;
message Empty {
}
enum OuterEnum {
FOO = 1;
BAR = 2;
}
message EnumContainer {
optional OuterEnum outer_enum = 1;
}
message Simple1 {
required string a_string = 1;
repeated string a_repeated_string = 2;
optional bool a_boolean = 3;
}
// A message that differs from Simple1 only by name
message Simple2 {
required string a_string = 1;
repeated string a_repeated_string = 2;
}
message SpecialCases {
required string normal = 1;
// Examples of Js reserved names that are converted to pb_<name>.
required string default = 2;
required string function = 3;
required string var = 4;
}
message OptionalFields {
message Nested {
optional int32 an_int = 1;
}
optional string a_string = 1;
required bool a_bool = 2;
optional Nested a_nested_message = 3;
repeated Nested a_repeated_message = 4;
repeated string a_repeated_string = 5;
}
message HasExtensions {
optional string str1 = 1;
optional string str2 = 2;
optional string str3 = 3;
extensions 10 to max;
}
message Complex {
message Nested {
required int32 an_int = 2;
}
required string a_string = 1;
required bool an_out_of_order_bool = 9;
optional Nested a_nested_message = 4;
repeated Nested a_repeated_message = 5;
repeated string a_repeated_string = 7;
}
message IsExtension {
extend HasExtensions {
optional IsExtension ext_field = 100;
}
optional string ext1 = 1;
// Extensions of proto2 Descriptor messages will be ignored.
extend google.protobuf.EnumOptions {
optional string simple_option = 42113038;
}
}
message IndirectExtension {
extend HasExtensions {
optional Simple1 simple = 101;
optional string str = 102;
repeated string repeated_str = 103;
repeated Simple1 repeated_simple = 104;
}
}
extend HasExtensions {
optional Simple1 simple1 = 105;
}
message DefaultValues {
enum Enum {
E1 = 13;
E2 = 77;
}
optional string string_field = 1 [default="default<>\'\"abc"];
optional bool bool_field = 2 [default=true];
optional int64 int_field = 3 [default=11];
optional Enum enum_field = 4 [default=E1];
optional string empty_field = 6 [default=""];
optional bytes bytes_field = 8 [default="moo"]; // Base64 encoding is "bW9v"
}
message TestClone {
optional string str = 1;
optional Simple1 simple1 = 3;
repeated Simple1 simple2 = 5;
optional string unused = 7;
extensions 10 to max;
}
message CloneExtension {
extend TestClone {
optional CloneExtension ext_field = 100;
}
optional string ext = 2;
}
message TestGroup {
repeated group RepeatedGroup = 1 {
required string id = 1;
repeated bool some_bool = 2;
}
required group RequiredGroup = 2 {
required string id = 1;
}
optional group OptionalGroup = 3 {
required string id = 1;
}
optional string id = 4;
required Simple2 required_simple = 5;
optional Simple2 optional_simple = 6;
}
message TestGroup1 {
optional TestGroup.RepeatedGroup group = 1;
}
message TestReservedNames {
optional int32 extension = 1;
extensions 10 to max;
}
message TestReservedNamesExtension {
extend TestReservedNames {
optional int32 foo = 10;
}
}
message TestMessageWithOneof {
oneof partial_oneof {
string pone = 3;
string pthree = 5;
}
oneof recursive_oneof {
TestMessageWithOneof rone = 6;
string rtwo = 7;
}
optional bool normal_field = 8;
repeated string repeated_field = 9;
oneof default_oneof_a {
int32 aone = 10 [default = 1234];
int32 atwo = 11;
}
oneof default_oneof_b {
int32 bone = 12;
int32 btwo = 13 [default = 1234];
}
}
|