blob: 60c70190f63e30107019b3267b57da32cc10048f [file] [log] [blame]
Feng Xiaoe841bac2015-12-11 17:09:20 -08001// Protocol Buffers - Google's data interchange format
2// Copyright 2008 Google Inc. All rights reserved.
3// https://developers.google.com/protocol-buffers/
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
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
14// distribution.
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.
18//
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.
30
31// LINT: ALLOW_GROUPS
32
33syntax = "proto2";
34
35
36package jspb.test;
37
38// These types are borrowed from `unittest.proto` in the protobuf tree. We want
39// to ensure that the binary-format support will handle all field types
40// properly.
41message TestAllTypes {
42 optional int32 optional_int32 = 1;
43 optional int64 optional_int64 = 2;
44 optional uint32 optional_uint32 = 3;
45 optional uint64 optional_uint64 = 4;
46 optional sint32 optional_sint32 = 5;
47 optional sint64 optional_sint64 = 6;
48 optional fixed32 optional_fixed32 = 7;
49 optional fixed64 optional_fixed64 = 8;
50 optional sfixed32 optional_sfixed32 = 9;
51 optional sfixed64 optional_sfixed64 = 10;
52 optional float optional_float = 11;
53 optional double optional_double = 12;
54 optional bool optional_bool = 13;
55 optional string optional_string = 14;
56 optional bytes optional_bytes = 15;
57 optional group OptionalGroup = 16 {
58 optional int32 a = 17;
59 }
60
61 optional ForeignMessage optional_foreign_message = 19;
62 optional ForeignEnum optional_foreign_enum = 22;
63
64 // Repeated
65 repeated int32 repeated_int32 = 31;
66 repeated int64 repeated_int64 = 32;
67 repeated uint32 repeated_uint32 = 33;
68 repeated uint64 repeated_uint64 = 34;
69 repeated sint32 repeated_sint32 = 35;
70 repeated sint64 repeated_sint64 = 36;
71 repeated fixed32 repeated_fixed32 = 37;
72 repeated fixed64 repeated_fixed64 = 38;
73 repeated sfixed32 repeated_sfixed32 = 39;
74 repeated sfixed64 repeated_sfixed64 = 40;
75 repeated float repeated_float = 41;
76 repeated double repeated_double = 42;
77 repeated bool repeated_bool = 43;
78 repeated string repeated_string = 44;
79 repeated bytes repeated_bytes = 45;
80
81 repeated group RepeatedGroup = 46 {
82 optional int32 a = 47;
83 }
84
85 repeated ForeignMessage repeated_foreign_message = 49;
86 repeated ForeignEnum repeated_foreign_enum = 52;
87
88 // Packed repeated
89 repeated int32 packed_repeated_int32 = 61 [packed=true];
90 repeated int64 packed_repeated_int64 = 62 [packed=true];
91 repeated uint32 packed_repeated_uint32 = 63 [packed=true];
92 repeated uint64 packed_repeated_uint64 = 64 [packed=true];
93 repeated sint32 packed_repeated_sint32 = 65 [packed=true];
94 repeated sint64 packed_repeated_sint64 = 66 [packed=true];
95 repeated fixed32 packed_repeated_fixed32 = 67 [packed=true];
96 repeated fixed64 packed_repeated_fixed64 = 68 [packed=true];
97 repeated sfixed32 packed_repeated_sfixed32 = 69 [packed=true];
98 repeated sfixed64 packed_repeated_sfixed64 = 70 [packed=true];
99 repeated float packed_repeated_float = 71 [packed=true];
100 repeated double packed_repeated_double = 72 [packed=true];
101 repeated bool packed_repeated_bool = 73 [packed=true];
102
103 oneof oneof_field {
104 uint32 oneof_uint32 = 111;
105 ForeignMessage oneof_foreign_message = 112;
106 string oneof_string = 113;
107 bytes oneof_bytes = 114;
108 }
109
110}
111
112message ForeignMessage {
113 optional int32 c = 1;
114}
115
116enum ForeignEnum {
117 FOREIGN_FOO = 4;
118 FOREIGN_BAR = 5;
119 FOREIGN_BAZ = 6;
120}
121
122message TestExtendable {
123 extensions 1 to max;
124}
125
126message ExtendsWithMessage {
127 extend TestExtendable {
128 optional ExtendsWithMessage optional_extension = 19;
129 repeated ExtendsWithMessage repeated_extension = 49;
130 }
131 optional int32 foo = 1;
132}
133
134extend TestExtendable {
135 optional int32 extend_optional_int32 = 1;
136 optional int64 extend_optional_int64 = 2;
137 optional uint32 extend_optional_uint32 = 3;
138 optional uint64 extend_optional_uint64 = 4;
139 optional sint32 extend_optional_sint32 = 5;
140 optional sint64 extend_optional_sint64 = 6;
141 optional fixed32 extend_optional_fixed32 = 7;
142 optional fixed64 extend_optional_fixed64 = 8;
143 optional sfixed32 extend_optional_sfixed32 = 9;
144 optional sfixed64 extend_optional_sfixed64 = 10;
145 optional float extend_optional_float = 11;
146 optional double extend_optional_double = 12;
147 optional bool extend_optional_bool = 13;
148 optional string extend_optional_string = 14;
149 optional bytes extend_optional_bytes = 15;
150 optional ForeignEnum extend_optional_foreign_enum = 22;
151
152 repeated int32 extend_repeated_int32 = 31;
153 repeated int64 extend_repeated_int64 = 32;
154 repeated uint32 extend_repeated_uint32 = 33;
155 repeated uint64 extend_repeated_uint64 = 34;
156 repeated sint32 extend_repeated_sint32 = 35;
157 repeated sint64 extend_repeated_sint64 = 36;
158 repeated fixed32 extend_repeated_fixed32 = 37;
159 repeated fixed64 extend_repeated_fixed64 = 38;
160 repeated sfixed32 extend_repeated_sfixed32 = 39;
161 repeated sfixed64 extend_repeated_sfixed64 = 40;
162 repeated float extend_repeated_float = 41;
163 repeated double extend_repeated_double = 42;
164 repeated bool extend_repeated_bool = 43;
165 repeated string extend_repeated_string = 44;
166 repeated bytes extend_repeated_bytes = 45;
167 repeated ForeignEnum extend_repeated_foreign_enum = 52;
168
169 repeated int32 extend_packed_repeated_int32 = 61 [packed=true];
170 repeated int64 extend_packed_repeated_int64 = 62 [packed=true];
171 repeated uint32 extend_packed_repeated_uint32 = 63 [packed=true];
172 repeated uint64 extend_packed_repeated_uint64 = 64 [packed=true];
173 repeated sint32 extend_packed_repeated_sint32 = 65 [packed=true];
174 repeated sint64 extend_packed_repeated_sint64 = 66 [packed=true];
175 repeated fixed32 extend_packed_repeated_fixed32 = 67 [packed=true];
176 repeated fixed64 extend_packed_repeated_fixed64 = 68 [packed=true];
177 repeated sfixed32 extend_packed_repeated_sfixed32 = 69 [packed=true];
178 repeated sfixed64 extend_packed_repeated_sfixed64 = 70 [packed=true];
179 repeated float extend_packed_repeated_float = 71 [packed=true];
180 repeated double extend_packed_repeated_double = 72 [packed=true];
181 repeated bool extend_packed_repeated_bool = 73 [packed=true];
182 repeated ForeignEnum extend_packed_repeated_foreign_enum = 82
183 [packed=true];
184
185}