OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 14 matching lines...) Expand all Loading... |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 syntax = "proto3"; | 31 syntax = "proto3"; |
32 package conformance; | 32 package conformance; |
33 option java_package = "com.google.protobuf.conformance"; | 33 option java_package = "com.google.protobuf.conformance"; |
34 | 34 |
35 import "google/protobuf/any.proto"; | |
36 import "google/protobuf/duration.proto"; | |
37 import "google/protobuf/field_mask.proto"; | |
38 import "google/protobuf/struct.proto"; | |
39 import "google/protobuf/timestamp.proto"; | |
40 import "google/protobuf/wrappers.proto"; | |
41 | |
42 // This defines the conformance testing protocol. This protocol exists between | 35 // This defines the conformance testing protocol. This protocol exists between |
43 // the conformance test suite itself and the code being tested. For each test, | 36 // the conformance test suite itself and the code being tested. For each test, |
44 // the suite will send a ConformanceRequest message and expect a | 37 // the suite will send a ConformanceRequest message and expect a |
45 // ConformanceResponse message. | 38 // ConformanceResponse message. |
46 // | 39 // |
47 // You can either run the tests in two different ways: | 40 // You can either run the tests in two different ways: |
48 // | 41 // |
49 // 1. in-process (using the interface in conformance_test.h). | 42 // 1. in-process (using the interface in conformance_test.h). |
50 // | 43 // |
51 // 2. as a sub-process communicating over a pipe. Information about how to | 44 // 2. as a sub-process communicating over a pipe. Information about how to |
(...skipping 11 matching lines...) Expand all Loading... |
63 PROTOBUF = 1; | 56 PROTOBUF = 1; |
64 JSON = 2; | 57 JSON = 2; |
65 } | 58 } |
66 | 59 |
67 // Represents a single test case's input. The testee should: | 60 // Represents a single test case's input. The testee should: |
68 // | 61 // |
69 // 1. parse this proto (which should always succeed) | 62 // 1. parse this proto (which should always succeed) |
70 // 2. parse the protobuf or JSON payload in "payload" (which may fail) | 63 // 2. parse the protobuf or JSON payload in "payload" (which may fail) |
71 // 3. if the parse succeeded, serialize the message in the requested format. | 64 // 3. if the parse succeeded, serialize the message in the requested format. |
72 message ConformanceRequest { | 65 message ConformanceRequest { |
73 // The payload (whether protobuf of JSON) is always for a TestAllTypes proto | 66 // The payload (whether protobuf of JSON) is always for a |
74 // (see below). | 67 // protobuf_test_messages.proto3.TestAllTypes proto (as defined in |
| 68 // src/google/protobuf/proto3_test_messages.proto). |
| 69 // |
| 70 // TODO(haberman): if/when we expand the conformance tests to support proto2, |
| 71 // we will want to include a field that lets the payload/response be a |
| 72 // protobuf_test_messages.proto2.TestAllTypes message instead. |
75 oneof payload { | 73 oneof payload { |
76 bytes protobuf_payload = 1; | 74 bytes protobuf_payload = 1; |
77 string json_payload = 2; | 75 string json_payload = 2; |
78 } | 76 } |
79 | 77 |
80 // Which format should the testee serialize its message to? | 78 // Which format should the testee serialize its message to? |
81 WireFormat requested_output_format = 3; | 79 WireFormat requested_output_format = 3; |
82 } | 80 } |
83 | 81 |
84 // Represents a single test case's output. | 82 // Represents a single test case's output. |
(...skipping 22 matching lines...) Expand all Loading... |
107 | 105 |
108 // If the input was successfully parsed and the requested output was JSON, | 106 // If the input was successfully parsed and the requested output was JSON, |
109 // serialize to JSON and set it in this field. | 107 // serialize to JSON and set it in this field. |
110 string json_payload = 4; | 108 string json_payload = 4; |
111 | 109 |
112 // For when the testee skipped the test, likely because a certain feature | 110 // For when the testee skipped the test, likely because a certain feature |
113 // wasn't supported, like JSON input/output. | 111 // wasn't supported, like JSON input/output. |
114 string skipped = 5; | 112 string skipped = 5; |
115 } | 113 } |
116 } | 114 } |
117 | |
118 // This proto includes every type of field in both singular and repeated | |
119 // forms. | |
120 message TestAllTypes { | |
121 message NestedMessage { | |
122 int32 a = 1; | |
123 TestAllTypes corecursive = 2; | |
124 } | |
125 | |
126 enum NestedEnum { | |
127 FOO = 0; | |
128 BAR = 1; | |
129 BAZ = 2; | |
130 NEG = -1; // Intentionally negative. | |
131 } | |
132 | |
133 // Singular | |
134 int32 optional_int32 = 1; | |
135 int64 optional_int64 = 2; | |
136 uint32 optional_uint32 = 3; | |
137 uint64 optional_uint64 = 4; | |
138 sint32 optional_sint32 = 5; | |
139 sint64 optional_sint64 = 6; | |
140 fixed32 optional_fixed32 = 7; | |
141 fixed64 optional_fixed64 = 8; | |
142 sfixed32 optional_sfixed32 = 9; | |
143 sfixed64 optional_sfixed64 = 10; | |
144 float optional_float = 11; | |
145 double optional_double = 12; | |
146 bool optional_bool = 13; | |
147 string optional_string = 14; | |
148 bytes optional_bytes = 15; | |
149 | |
150 NestedMessage optional_nested_message = 18; | |
151 ForeignMessage optional_foreign_message = 19; | |
152 | |
153 NestedEnum optional_nested_enum = 21; | |
154 ForeignEnum optional_foreign_enum = 22; | |
155 | |
156 string optional_string_piece = 24 [ctype=STRING_PIECE]; | |
157 string optional_cord = 25 [ctype=CORD]; | |
158 | |
159 TestAllTypes recursive_message = 27; | |
160 | |
161 // Repeated | |
162 repeated int32 repeated_int32 = 31; | |
163 repeated int64 repeated_int64 = 32; | |
164 repeated uint32 repeated_uint32 = 33; | |
165 repeated uint64 repeated_uint64 = 34; | |
166 repeated sint32 repeated_sint32 = 35; | |
167 repeated sint64 repeated_sint64 = 36; | |
168 repeated fixed32 repeated_fixed32 = 37; | |
169 repeated fixed64 repeated_fixed64 = 38; | |
170 repeated sfixed32 repeated_sfixed32 = 39; | |
171 repeated sfixed64 repeated_sfixed64 = 40; | |
172 repeated float repeated_float = 41; | |
173 repeated double repeated_double = 42; | |
174 repeated bool repeated_bool = 43; | |
175 repeated string repeated_string = 44; | |
176 repeated bytes repeated_bytes = 45; | |
177 | |
178 repeated NestedMessage repeated_nested_message = 48; | |
179 repeated ForeignMessage repeated_foreign_message = 49; | |
180 | |
181 repeated NestedEnum repeated_nested_enum = 51; | |
182 repeated ForeignEnum repeated_foreign_enum = 52; | |
183 | |
184 repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; | |
185 repeated string repeated_cord = 55 [ctype=CORD]; | |
186 | |
187 // Map | |
188 map < int32, int32> map_int32_int32 = 56; | |
189 map < int64, int64> map_int64_int64 = 57; | |
190 map < uint32, uint32> map_uint32_uint32 = 58; | |
191 map < uint64, uint64> map_uint64_uint64 = 59; | |
192 map < sint32, sint32> map_sint32_sint32 = 60; | |
193 map < sint64, sint64> map_sint64_sint64 = 61; | |
194 map < fixed32, fixed32> map_fixed32_fixed32 = 62; | |
195 map < fixed64, fixed64> map_fixed64_fixed64 = 63; | |
196 map <sfixed32, sfixed32> map_sfixed32_sfixed32 = 64; | |
197 map <sfixed64, sfixed64> map_sfixed64_sfixed64 = 65; | |
198 map < int32, float> map_int32_float = 66; | |
199 map < int32, double> map_int32_double = 67; | |
200 map < bool, bool> map_bool_bool = 68; | |
201 map < string, string> map_string_string = 69; | |
202 map < string, bytes> map_string_bytes = 70; | |
203 map < string, NestedMessage> map_string_nested_message = 71; | |
204 map < string, ForeignMessage> map_string_foreign_message = 72; | |
205 map < string, NestedEnum> map_string_nested_enum = 73; | |
206 map < string, ForeignEnum> map_string_foreign_enum = 74; | |
207 | |
208 oneof oneof_field { | |
209 uint32 oneof_uint32 = 111; | |
210 NestedMessage oneof_nested_message = 112; | |
211 string oneof_string = 113; | |
212 bytes oneof_bytes = 114; | |
213 } | |
214 | |
215 // Well-known types | |
216 google.protobuf.BoolValue optional_bool_wrapper = 201; | |
217 google.protobuf.Int32Value optional_int32_wrapper = 202; | |
218 google.protobuf.Int64Value optional_int64_wrapper = 203; | |
219 google.protobuf.UInt32Value optional_uint32_wrapper = 204; | |
220 google.protobuf.UInt64Value optional_uint64_wrapper = 205; | |
221 google.protobuf.FloatValue optional_float_wrapper = 206; | |
222 google.protobuf.DoubleValue optional_double_wrapper = 207; | |
223 google.protobuf.StringValue optional_string_wrapper = 208; | |
224 google.protobuf.BytesValue optional_bytes_wrapper = 209; | |
225 | |
226 repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; | |
227 repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; | |
228 repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; | |
229 repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; | |
230 repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; | |
231 repeated google.protobuf.FloatValue repeated_float_wrapper = 216; | |
232 repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; | |
233 repeated google.protobuf.StringValue repeated_string_wrapper = 218; | |
234 repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; | |
235 | |
236 google.protobuf.Duration optional_duration = 301; | |
237 google.protobuf.Timestamp optional_timestamp = 302; | |
238 google.protobuf.FieldMask optional_field_mask = 303; | |
239 google.protobuf.Struct optional_struct = 304; | |
240 google.protobuf.Any optional_any = 305; | |
241 google.protobuf.Value optional_value = 306; | |
242 | |
243 repeated google.protobuf.Duration repeated_duration = 311; | |
244 repeated google.protobuf.Timestamp repeated_timestamp = 312; | |
245 repeated google.protobuf.FieldMask repeated_fieldmask = 313; | |
246 repeated google.protobuf.Struct repeated_struct = 324; | |
247 repeated google.protobuf.Any repeated_any = 315; | |
248 repeated google.protobuf.Value repeated_value = 316; | |
249 | |
250 // Test field-name-to-JSON-name convention. | |
251 int32 fieldname1 = 401; | |
252 int32 field_name2 = 402; | |
253 int32 _field_name3 = 403; | |
254 int32 field__name4_ = 404; | |
255 int32 field0name5 = 405; | |
256 int32 field_0_name6 = 406; | |
257 int32 fieldName7 = 407; | |
258 int32 FieldName8 = 408; | |
259 int32 field_Name9 = 409; | |
260 int32 Field_Name10 = 410; | |
261 int32 FIELD_NAME11 = 411; | |
262 int32 FIELD_name12 = 412; | |
263 } | |
264 | |
265 message ForeignMessage { | |
266 int32 c = 1; | |
267 } | |
268 | |
269 enum ForeignEnum { | |
270 FOREIGN_FOO = 0; | |
271 FOREIGN_BAR = 1; | |
272 FOREIGN_BAZ = 2; | |
273 } | |
OLD | NEW |