protobug_conformance_protos 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 88c4e5f65dee43cf1cd9a10344a08a5c454864616e85d866a1c4a9a9f06cdcba
4
+ data.tar.gz: 959797321bde3c53b1858973cdd9536254f161d0d02b869f93602c5ea388cc8f
5
+ SHA512:
6
+ metadata.gz: 5a5745c5095abb4f02100db803e512e729027271572d2b302afa3c3225879efcf00522273de807d33293d3158d6cbbf9b08bf75224c91d6a0a7b3dbab0749308
7
+ data.tar.gz: 99087cda62dac2881b2195456d16fcf610fb66da2b1fc00bc989e2cefea74cde9adfce09e73b0692921c1c8fa07f06ea355ea97ece6c81ace5fd87d5e91cf87b
@@ -0,0 +1,317 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by protoc-gen-protobug. DO NOT EDIT.
4
+
5
+ # source: conformance.proto
6
+ # syntax: proto3
7
+ # package: conformance
8
+ # options:
9
+ # java_package: "com.google.protobuf.conformance"
10
+ # objc_class_prefix: "Conformance"
11
+
12
+ # Protocol Buffers - Google's data interchange format
13
+ # Copyright 2008 Google Inc. All rights reserved.
14
+ #
15
+ # Use of this source code is governed by a BSD-style
16
+ # license that can be found in the LICENSE file or at
17
+ # https://developers.google.com/open-source/licenses/bsd
18
+
19
+ require "protobug"
20
+
21
+ module Conformance
22
+ # This defines the conformance testing protocol. This protocol exists between
23
+ # the conformance test suite itself and the code being tested. For each test,
24
+ # the suite will send a ConformanceRequest message and expect a
25
+ # ConformanceResponse message.
26
+ #
27
+ # You can either run the tests in two different ways:
28
+ #
29
+ # 1. in-process (using the interface in conformance_test.h).
30
+ #
31
+ # 2. as a sub-process communicating over a pipe. Information about how to
32
+ # do this is in conformance_test_runner.cc.
33
+ #
34
+ # Pros/cons of the two approaches:
35
+ #
36
+ # - running as a sub-process is much simpler for languages other than C/C++.
37
+ #
38
+ # - running as a sub-process may be more tricky in unusual environments like
39
+ # iOS apps, where fork/stdin/stdout are not available.
40
+
41
+ class WireFormat
42
+ extend Protobug::Enum
43
+
44
+ self.full_name = "conformance.WireFormat"
45
+
46
+ UNSPECIFIED = new("UNSPECIFIED", 0).freeze
47
+ PROTOBUF = new("PROTOBUF", 1).freeze
48
+ JSON = new("JSON", 2).freeze
49
+ JSPB = new(
50
+ "JSPB",
51
+ 3
52
+ ).freeze # Only used inside Google. Opensource testees just skip it.
53
+ TEXT_FORMAT = new("TEXT_FORMAT", 4).freeze
54
+ end
55
+
56
+ class TestCategory
57
+ extend Protobug::Enum
58
+
59
+ self.full_name = "conformance.TestCategory"
60
+
61
+ UNSPECIFIED_TEST = new("UNSPECIFIED_TEST", 0).freeze
62
+ BINARY_TEST = new("BINARY_TEST", 1).freeze # Test binary wire format.
63
+ JSON_TEST = new("JSON_TEST", 2).freeze # Test json wire format.
64
+ # Similar to JSON_TEST. However, during parsing json, testee should ignore
65
+ # unknown fields. This feature is optional. Each implementation can decide
66
+ # whether to support it. See
67
+ # https://developers.google.com/protocol-buffers/docs/proto3#json_options
68
+ # for more detail.
69
+ JSON_IGNORE_UNKNOWN_PARSING_TEST = new(
70
+ "JSON_IGNORE_UNKNOWN_PARSING_TEST",
71
+ 3
72
+ ).freeze
73
+ # Test jspb wire format. Only used inside Google. Opensource testees just
74
+ # skip it.
75
+ JSPB_TEST = new("JSPB_TEST", 4).freeze
76
+ # Test text format. For cpp, java and python, testees can already deal with
77
+ # this type. Testees of other languages can simply skip it.
78
+ TEXT_FORMAT_TEST = new("TEXT_FORMAT_TEST", 5).freeze
79
+ end
80
+
81
+ # The conformance runner will request a list of failures as the first request.
82
+ # This will be known by message_type == "conformance.FailureSet", a conformance
83
+ # test should return a serialized FailureSet in protobuf_payload.
84
+ class FailureSet
85
+ extend Protobug::Message
86
+
87
+ self.full_name = "conformance.FailureSet"
88
+
89
+ repeated(1, "failure", type: :string)
90
+ end
91
+
92
+ # Represents a single test case's input. The testee should:
93
+ #
94
+ # 1. parse this proto (which should always succeed)
95
+ # 2. parse the protobuf or JSON payload in "payload" (which may fail)
96
+ # 3. if the parse succeeded, serialize the message in the requested format.
97
+ class ConformanceRequest
98
+ extend Protobug::Message
99
+
100
+ self.full_name = "conformance.ConformanceRequest"
101
+
102
+ # The payload (whether protobuf of JSON) is always for a
103
+ # protobuf_test_messages.proto3.TestAllTypes proto (as defined in
104
+ # src/google/protobuf/proto3_test_messages.proto).
105
+
106
+ optional(
107
+ 1,
108
+ "protobuf_payload",
109
+ type: :bytes,
110
+ json_name: "protobufPayload",
111
+ oneof: :payload,
112
+ proto3_optional: false
113
+ )
114
+ optional(
115
+ 2,
116
+ "json_payload",
117
+ type: :string,
118
+ json_name: "jsonPayload",
119
+ oneof: :payload,
120
+ proto3_optional: false
121
+ )
122
+ # Only used inside Google. Opensource testees just skip it.
123
+ optional(
124
+ 7,
125
+ "jspb_payload",
126
+ type: :string,
127
+ json_name: "jspbPayload",
128
+ oneof: :payload,
129
+ proto3_optional: false
130
+ )
131
+ optional(
132
+ 8,
133
+ "text_payload",
134
+ type: :string,
135
+ json_name: "textPayload",
136
+ oneof: :payload,
137
+ proto3_optional: false
138
+ )
139
+ # Which format should the testee serialize its message to?
140
+ optional(
141
+ 3,
142
+ "requested_output_format",
143
+ type: :enum,
144
+ enum_type: "conformance.WireFormat",
145
+ json_name: "requestedOutputFormat",
146
+ proto3_optional: false
147
+ )
148
+ # The full name for the test message to use; for the moment, either:
149
+ # protobuf_test_messages.proto3.TestAllTypesProto3 or
150
+ # protobuf_test_messages.google.protobuf.TestAllTypesProto2.
151
+ optional(
152
+ 4,
153
+ "message_type",
154
+ type: :string,
155
+ json_name: "messageType",
156
+ proto3_optional: false
157
+ )
158
+ # Each test is given a specific test category. Some category may need
159
+ # specific support in testee programs. Refer to the definition of
160
+ # TestCategory for more information.
161
+ optional(
162
+ 5,
163
+ "test_category",
164
+ type: :enum,
165
+ enum_type: "conformance.TestCategory",
166
+ json_name: "testCategory",
167
+ proto3_optional: false
168
+ )
169
+ # Specify details for how to encode jspb.
170
+ optional(
171
+ 6,
172
+ "jspb_encoding_options",
173
+ type: :message,
174
+ message_type: "conformance.JspbEncodingConfig",
175
+ json_name: "jspbEncodingOptions",
176
+ proto3_optional: false
177
+ )
178
+ # This can be used in json and text format. If true, testee should print
179
+ # unknown fields instead of ignore. This feature is optional.
180
+ optional(
181
+ 9,
182
+ "print_unknown_fields",
183
+ type: :bool,
184
+ json_name: "printUnknownFields",
185
+ proto3_optional: false
186
+ )
187
+ end
188
+
189
+ # Represents a single test case's output.
190
+ class ConformanceResponse
191
+ extend Protobug::Message
192
+
193
+ self.full_name = "conformance.ConformanceResponse"
194
+
195
+ # This string should be set to indicate parsing failed. The string can
196
+ # provide more information about the parse error if it is available.
197
+ #
198
+ # Setting this string does not necessarily mean the testee failed the
199
+ # test. Some of the test cases are intentionally invalid input.
200
+ optional(
201
+ 1,
202
+ "parse_error",
203
+ type: :string,
204
+ json_name: "parseError",
205
+ oneof: :result,
206
+ proto3_optional: false
207
+ )
208
+ # If the input was successfully parsed but errors occurred when
209
+ # serializing it to the requested output format, set the error message in
210
+ # this field.
211
+ optional(
212
+ 6,
213
+ "serialize_error",
214
+ type: :string,
215
+ json_name: "serializeError",
216
+ oneof: :result,
217
+ proto3_optional: false
218
+ )
219
+ # This should be set if the test program timed out. The string should
220
+ # provide more information about what the child process was doing when it
221
+ # was killed.
222
+ optional(
223
+ 9,
224
+ "timeout_error",
225
+ type: :string,
226
+ json_name: "timeoutError",
227
+ oneof: :result,
228
+ proto3_optional: false
229
+ )
230
+ # This should be set if some other error occurred. This will always
231
+ # indicate that the test failed. The string can provide more information
232
+ # about the failure.
233
+ optional(
234
+ 2,
235
+ "runtime_error",
236
+ type: :string,
237
+ json_name: "runtimeError",
238
+ oneof: :result,
239
+ proto3_optional: false
240
+ )
241
+ # If the input was successfully parsed and the requested output was
242
+ # protobuf, serialize it to protobuf and set it in this field.
243
+ optional(
244
+ 3,
245
+ "protobuf_payload",
246
+ type: :bytes,
247
+ json_name: "protobufPayload",
248
+ oneof: :result,
249
+ proto3_optional: false
250
+ )
251
+ # If the input was successfully parsed and the requested output was JSON,
252
+ # serialize to JSON and set it in this field.
253
+ optional(
254
+ 4,
255
+ "json_payload",
256
+ type: :string,
257
+ json_name: "jsonPayload",
258
+ oneof: :result,
259
+ proto3_optional: false
260
+ )
261
+ # For when the testee skipped the test, likely because a certain feature
262
+ # wasn't supported, like JSON input/output.
263
+ optional(
264
+ 5,
265
+ "skipped",
266
+ type: :string,
267
+ oneof: :result,
268
+ proto3_optional: false
269
+ )
270
+ # If the input was successfully parsed and the requested output was JSPB,
271
+ # serialize to JSPB and set it in this field. JSPB is only used inside
272
+ # Google. Opensource testees can just skip it.
273
+ optional(
274
+ 7,
275
+ "jspb_payload",
276
+ type: :string,
277
+ json_name: "jspbPayload",
278
+ oneof: :result,
279
+ proto3_optional: false
280
+ )
281
+ # If the input was successfully parsed and the requested output was
282
+ # TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field.
283
+ optional(
284
+ 8,
285
+ "text_payload",
286
+ type: :string,
287
+ json_name: "textPayload",
288
+ oneof: :result,
289
+ proto3_optional: false
290
+ )
291
+ end
292
+
293
+ # Encoding options for jspb format.
294
+ class JspbEncodingConfig
295
+ extend Protobug::Message
296
+
297
+ self.full_name = "conformance.JspbEncodingConfig"
298
+
299
+ # Encode the value field of Any as jspb array if true, otherwise binary.
300
+ optional(
301
+ 1,
302
+ "use_jspb_array_any_format",
303
+ type: :bool,
304
+ json_name: "useJspbArrayAnyFormat",
305
+ proto3_optional: false
306
+ )
307
+ end
308
+
309
+ def self.register_conformance_protos(registry)
310
+ registry.register(Conformance::WireFormat)
311
+ registry.register(Conformance::TestCategory)
312
+ registry.register(Conformance::FailureSet)
313
+ registry.register(Conformance::ConformanceRequest)
314
+ registry.register(Conformance::ConformanceResponse)
315
+ registry.register(Conformance::JspbEncodingConfig)
316
+ end
317
+ end