OSDN Git Service

versoin1.1.9 (#594)
[bytom/vapor.git] / vendor / github.com / golang / protobuf / _conformance / conformance_proto / conformance.proto
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 syntax = "proto3";
32 package conformance;
33 option java_package = "com.google.protobuf.conformance";
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
43 // the conformance test suite itself and the code being tested.  For each test,
44 // the suite will send a ConformanceRequest message and expect a
45 // ConformanceResponse message.
46 //
47 // You can either run the tests in two different ways:
48 //
49 //   1. in-process (using the interface in conformance_test.h).
50 //
51 //   2. as a sub-process communicating over a pipe.  Information about how to
52 //      do this is in conformance_test_runner.cc.
53 //
54 // Pros/cons of the two approaches:
55 //
56 //   - running as a sub-process is much simpler for languages other than C/C++.
57 //
58 //   - running as a sub-process may be more tricky in unusual environments like
59 //     iOS apps, where fork/stdin/stdout are not available.
60
61 enum WireFormat {
62   UNSPECIFIED = 0;
63   PROTOBUF = 1;
64   JSON = 2;
65 }
66
67 // Represents a single test case's input.  The testee should:
68 //
69 //   1. parse this proto (which should always succeed)
70 //   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.
72 message ConformanceRequest {
73   // The payload (whether protobuf of JSON) is always for a TestAllTypes proto
74   // (see below).
75   oneof payload {
76     bytes protobuf_payload = 1;
77     string json_payload = 2;
78   }
79
80   // Which format should the testee serialize its message to?
81   WireFormat requested_output_format = 3;
82 }
83
84 // Represents a single test case's output.
85 message ConformanceResponse {
86   oneof result {
87     // This string should be set to indicate parsing failed.  The string can
88     // provide more information about the parse error if it is available.
89     //
90     // Setting this string does not necessarily mean the testee failed the
91     // test.  Some of the test cases are intentionally invalid input.
92     string parse_error = 1;
93
94     // If the input was successfully parsed but errors occurred when
95     // serializing it to the requested output format, set the error message in
96     // this field.
97     string serialize_error = 6;
98
99     // This should be set if some other error occurred.  This will always
100     // indicate that the test failed.  The string can provide more information
101     // about the failure.
102     string runtime_error = 2;
103
104     // If the input was successfully parsed and the requested output was
105     // protobuf, serialize it to protobuf and set it in this field.
106     bytes protobuf_payload = 3;
107
108     // If the input was successfully parsed and the requested output was JSON,
109     // serialize to JSON and set it in this field.
110     string json_payload = 4;
111
112     // For when the testee skipped the test, likely because a certain feature
113     // wasn't supported, like JSON input/output.
114     string skipped = 5;
115   }
116 }
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     bool oneof_bool = 115;
214     uint64 oneof_uint64 = 116;
215     float oneof_float = 117;
216     double oneof_double = 118;
217     NestedEnum oneof_enum = 119;
218   }
219
220   // Well-known types
221   google.protobuf.BoolValue optional_bool_wrapper = 201;
222   google.protobuf.Int32Value optional_int32_wrapper = 202;
223   google.protobuf.Int64Value optional_int64_wrapper = 203;
224   google.protobuf.UInt32Value optional_uint32_wrapper = 204;
225   google.protobuf.UInt64Value optional_uint64_wrapper = 205;
226   google.protobuf.FloatValue optional_float_wrapper = 206;
227   google.protobuf.DoubleValue optional_double_wrapper = 207;
228   google.protobuf.StringValue optional_string_wrapper = 208;
229   google.protobuf.BytesValue optional_bytes_wrapper = 209;
230
231   repeated google.protobuf.BoolValue repeated_bool_wrapper = 211;
232   repeated google.protobuf.Int32Value repeated_int32_wrapper = 212;
233   repeated google.protobuf.Int64Value repeated_int64_wrapper = 213;
234   repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214;
235   repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215;
236   repeated google.protobuf.FloatValue repeated_float_wrapper = 216;
237   repeated google.protobuf.DoubleValue repeated_double_wrapper = 217;
238   repeated google.protobuf.StringValue repeated_string_wrapper = 218;
239   repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219;
240
241   google.protobuf.Duration optional_duration = 301;
242   google.protobuf.Timestamp optional_timestamp = 302;
243   google.protobuf.FieldMask optional_field_mask = 303;
244   google.protobuf.Struct optional_struct = 304;
245   google.protobuf.Any optional_any = 305;
246   google.protobuf.Value optional_value = 306;
247
248   repeated google.protobuf.Duration repeated_duration = 311;
249   repeated google.protobuf.Timestamp repeated_timestamp = 312;
250   repeated google.protobuf.FieldMask repeated_fieldmask = 313;
251   repeated google.protobuf.Struct repeated_struct = 324;
252   repeated google.protobuf.Any repeated_any = 315;
253   repeated google.protobuf.Value repeated_value = 316;
254
255   // Test field-name-to-JSON-name convention.
256   // (protobuf says names can be any valid C/C++ identifier.)
257   int32 fieldname1 = 401;
258   int32 field_name2 = 402;
259   int32 _field_name3 = 403;
260   int32 field__name4_ = 404;
261   int32 field0name5 = 405;
262   int32 field_0_name6 = 406;
263   int32 fieldName7 = 407;
264   int32 FieldName8 = 408;
265   int32 field_Name9 = 409;
266   int32 Field_Name10 = 410;
267   int32 FIELD_NAME11 = 411;
268   int32 FIELD_name12 = 412;
269   int32 __field_name13 = 413;
270   int32 __Field_name14 = 414;
271   int32 field__name15 = 415;
272   int32 field__Name16 = 416;
273   int32 field_name17__ = 417;
274   int32 Field_name18__ = 418;
275 }
276
277 message ForeignMessage {
278   int32 c = 1;
279 }
280
281 enum ForeignEnum {
282   FOREIGN_FOO = 0;
283   FOREIGN_BAR = 1;
284   FOREIGN_BAZ = 2;
285 }