OLD | NEW |
| (Empty) |
1 // 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 // Test schema for proto3 messages. This test schema is used by: | |
32 // | |
33 // - benchmarks | |
34 // - fuzz tests | |
35 // - conformance tests | |
36 // | |
37 | |
38 syntax = "proto3"; | |
39 | |
40 package protobuf_test_messages.proto3; | |
41 option java_package = "com.google.protobuf_test_messages.proto3"; | |
42 | |
43 // This is the default, but we specify it here explicitly. | |
44 option optimize_for = SPEED; | |
45 | |
46 import "google/protobuf/any.proto"; | |
47 import "google/protobuf/duration.proto"; | |
48 import "google/protobuf/field_mask.proto"; | |
49 import "google/protobuf/struct.proto"; | |
50 import "google/protobuf/timestamp.proto"; | |
51 import "google/protobuf/wrappers.proto"; | |
52 | |
53 option cc_enable_arenas = true; | |
54 | |
55 // This proto includes every type of field in both singular and repeated | |
56 // forms. | |
57 // | |
58 // Also, crucially, all messages and enums in this file are eventually | |
59 // submessages of this message. So for example, a fuzz test of TestAllTypes | |
60 // could trigger bugs that occur in any message type in this file. We verify | |
61 // this stays true in a unit test. | |
62 message TestAllTypes { | |
63 message NestedMessage { | |
64 int32 a = 1; | |
65 TestAllTypes corecursive = 2; | |
66 } | |
67 | |
68 enum NestedEnum { | |
69 FOO = 0; | |
70 BAR = 1; | |
71 BAZ = 2; | |
72 NEG = -1; // Intentionally negative. | |
73 } | |
74 | |
75 // Singular | |
76 int32 optional_int32 = 1; | |
77 int64 optional_int64 = 2; | |
78 uint32 optional_uint32 = 3; | |
79 uint64 optional_uint64 = 4; | |
80 sint32 optional_sint32 = 5; | |
81 sint64 optional_sint64 = 6; | |
82 fixed32 optional_fixed32 = 7; | |
83 fixed64 optional_fixed64 = 8; | |
84 sfixed32 optional_sfixed32 = 9; | |
85 sfixed64 optional_sfixed64 = 10; | |
86 float optional_float = 11; | |
87 double optional_double = 12; | |
88 bool optional_bool = 13; | |
89 string optional_string = 14; | |
90 bytes optional_bytes = 15; | |
91 | |
92 NestedMessage optional_nested_message = 18; | |
93 ForeignMessage optional_foreign_message = 19; | |
94 | |
95 NestedEnum optional_nested_enum = 21; | |
96 ForeignEnum optional_foreign_enum = 22; | |
97 | |
98 string optional_string_piece = 24 [ctype=STRING_PIECE]; | |
99 string optional_cord = 25 [ctype=CORD]; | |
100 | |
101 TestAllTypes recursive_message = 27; | |
102 | |
103 // Repeated | |
104 repeated int32 repeated_int32 = 31; | |
105 repeated int64 repeated_int64 = 32; | |
106 repeated uint32 repeated_uint32 = 33; | |
107 repeated uint64 repeated_uint64 = 34; | |
108 repeated sint32 repeated_sint32 = 35; | |
109 repeated sint64 repeated_sint64 = 36; | |
110 repeated fixed32 repeated_fixed32 = 37; | |
111 repeated fixed64 repeated_fixed64 = 38; | |
112 repeated sfixed32 repeated_sfixed32 = 39; | |
113 repeated sfixed64 repeated_sfixed64 = 40; | |
114 repeated float repeated_float = 41; | |
115 repeated double repeated_double = 42; | |
116 repeated bool repeated_bool = 43; | |
117 repeated string repeated_string = 44; | |
118 repeated bytes repeated_bytes = 45; | |
119 | |
120 repeated NestedMessage repeated_nested_message = 48; | |
121 repeated ForeignMessage repeated_foreign_message = 49; | |
122 | |
123 repeated NestedEnum repeated_nested_enum = 51; | |
124 repeated ForeignEnum repeated_foreign_enum = 52; | |
125 | |
126 repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; | |
127 repeated string repeated_cord = 55 [ctype=CORD]; | |
128 | |
129 // Map | |
130 map < int32, int32> map_int32_int32 = 56; | |
131 map < int64, int64> map_int64_int64 = 57; | |
132 map < uint32, uint32> map_uint32_uint32 = 58; | |
133 map < uint64, uint64> map_uint64_uint64 = 59; | |
134 map < sint32, sint32> map_sint32_sint32 = 60; | |
135 map < sint64, sint64> map_sint64_sint64 = 61; | |
136 map < fixed32, fixed32> map_fixed32_fixed32 = 62; | |
137 map < fixed64, fixed64> map_fixed64_fixed64 = 63; | |
138 map <sfixed32, sfixed32> map_sfixed32_sfixed32 = 64; | |
139 map <sfixed64, sfixed64> map_sfixed64_sfixed64 = 65; | |
140 map < int32, float> map_int32_float = 66; | |
141 map < int32, double> map_int32_double = 67; | |
142 map < bool, bool> map_bool_bool = 68; | |
143 map < string, string> map_string_string = 69; | |
144 map < string, bytes> map_string_bytes = 70; | |
145 map < string, NestedMessage> map_string_nested_message = 71; | |
146 map < string, ForeignMessage> map_string_foreign_message = 72; | |
147 map < string, NestedEnum> map_string_nested_enum = 73; | |
148 map < string, ForeignEnum> map_string_foreign_enum = 74; | |
149 | |
150 oneof oneof_field { | |
151 uint32 oneof_uint32 = 111; | |
152 NestedMessage oneof_nested_message = 112; | |
153 string oneof_string = 113; | |
154 bytes oneof_bytes = 114; | |
155 bool oneof_bool = 115; | |
156 uint64 oneof_uint64 = 116; | |
157 float oneof_float = 117; | |
158 double oneof_double = 118; | |
159 NestedEnum oneof_enum = 119; | |
160 } | |
161 | |
162 // Well-known types | |
163 google.protobuf.BoolValue optional_bool_wrapper = 201; | |
164 google.protobuf.Int32Value optional_int32_wrapper = 202; | |
165 google.protobuf.Int64Value optional_int64_wrapper = 203; | |
166 google.protobuf.UInt32Value optional_uint32_wrapper = 204; | |
167 google.protobuf.UInt64Value optional_uint64_wrapper = 205; | |
168 google.protobuf.FloatValue optional_float_wrapper = 206; | |
169 google.protobuf.DoubleValue optional_double_wrapper = 207; | |
170 google.protobuf.StringValue optional_string_wrapper = 208; | |
171 google.protobuf.BytesValue optional_bytes_wrapper = 209; | |
172 | |
173 repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; | |
174 repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; | |
175 repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; | |
176 repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; | |
177 repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; | |
178 repeated google.protobuf.FloatValue repeated_float_wrapper = 216; | |
179 repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; | |
180 repeated google.protobuf.StringValue repeated_string_wrapper = 218; | |
181 repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; | |
182 | |
183 google.protobuf.Duration optional_duration = 301; | |
184 google.protobuf.Timestamp optional_timestamp = 302; | |
185 google.protobuf.FieldMask optional_field_mask = 303; | |
186 google.protobuf.Struct optional_struct = 304; | |
187 google.protobuf.Any optional_any = 305; | |
188 google.protobuf.Value optional_value = 306; | |
189 | |
190 repeated google.protobuf.Duration repeated_duration = 311; | |
191 repeated google.protobuf.Timestamp repeated_timestamp = 312; | |
192 repeated google.protobuf.FieldMask repeated_fieldmask = 313; | |
193 repeated google.protobuf.Struct repeated_struct = 324; | |
194 repeated google.protobuf.Any repeated_any = 315; | |
195 repeated google.protobuf.Value repeated_value = 316; | |
196 | |
197 // Test field-name-to-JSON-name convention. | |
198 // (protobuf says names can be any valid C/C++ identifier.) | |
199 int32 fieldname1 = 401; | |
200 int32 field_name2 = 402; | |
201 int32 _field_name3 = 403; | |
202 int32 field__name4_ = 404; | |
203 int32 field0name5 = 405; | |
204 int32 field_0_name6 = 406; | |
205 int32 fieldName7 = 407; | |
206 int32 FieldName8 = 408; | |
207 int32 field_Name9 = 409; | |
208 int32 Field_Name10 = 410; | |
209 int32 FIELD_NAME11 = 411; | |
210 int32 FIELD_name12 = 412; | |
211 int32 __field_name13 = 413; | |
212 int32 __Field_name14 = 414; | |
213 int32 field__name15 = 415; | |
214 int32 field__Name16 = 416; | |
215 int32 field_name17__ = 417; | |
216 int32 Field_name18__ = 418; | |
217 } | |
218 | |
219 message ForeignMessage { | |
220 int32 c = 1; | |
221 } | |
222 | |
223 enum ForeignEnum { | |
224 FOREIGN_FOO = 0; | |
225 FOREIGN_BAR = 1; | |
226 FOREIGN_BAZ = 2; | |
227 } | |
OLD | NEW |