avromatic 2.2.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +85 -0
- data/.rubocop.yml +3 -0
- data/.ruby-version +1 -1
- data/Appraisals +34 -22
- data/CHANGELOG.md +16 -0
- data/README.md +3 -3
- data/avromatic.gemspec +7 -6
- data/bin/console +4 -3
- data/gemfiles/{rails5_0.gemfile → avro1_10_rails5_2.gemfile} +3 -3
- data/gemfiles/avro1_10_rails6_0.gemfile +9 -0
- data/gemfiles/avro1_10_rails6_1.gemfile +9 -0
- data/gemfiles/{rails5_2.gemfile → avro1_8_rails5_2.gemfile} +0 -0
- data/gemfiles/{rails5_1.gemfile → avro1_9_rails5_2.gemfile} +3 -3
- data/gemfiles/{rails6_0.gemfile → avro1_9_rails6_0.gemfile} +1 -1
- data/gemfiles/{avro_patches_rails5_0.gemfile → avro1_9_rails6_1.gemfile} +3 -3
- data/gemfiles/avro_patches_rails5_2.gemfile +1 -1
- data/gemfiles/avro_patches_rails6_1.gemfile +9 -0
- data/lib/avromatic.rb +0 -5
- data/lib/avromatic/io.rb +1 -7
- data/lib/avromatic/io/datum_reader.rb +18 -68
- data/lib/avromatic/io/datum_writer.rb +5 -11
- data/lib/avromatic/io/union_datum.rb +25 -0
- data/lib/avromatic/messaging.rb +4 -2
- data/lib/avromatic/model/attributes.rb +6 -6
- data/lib/avromatic/model/configurable.rb +24 -0
- data/lib/avromatic/model/messaging_serialization.rb +2 -1
- data/lib/avromatic/model/raw_serialization.rb +14 -11
- data/lib/avromatic/model/types/abstract_timestamp_type.rb +1 -1
- data/lib/avromatic/model/types/abstract_type.rb +3 -1
- data/lib/avromatic/model/types/array_type.rb +2 -2
- data/lib/avromatic/model/types/boolean_type.rb +1 -1
- data/lib/avromatic/model/types/custom_type.rb +1 -1
- data/lib/avromatic/model/types/date_type.rb +1 -1
- data/lib/avromatic/model/types/enum_type.rb +1 -1
- data/lib/avromatic/model/types/fixed_type.rb +1 -1
- data/lib/avromatic/model/types/float_type.rb +1 -1
- data/lib/avromatic/model/types/integer_type.rb +1 -1
- data/lib/avromatic/model/types/map_type.rb +2 -2
- data/lib/avromatic/model/types/null_type.rb +1 -1
- data/lib/avromatic/model/types/record_type.rb +1 -5
- data/lib/avromatic/model/types/string_type.rb +1 -1
- data/lib/avromatic/model/types/timestamp_micros_type.rb +4 -4
- data/lib/avromatic/model/types/timestamp_millis_type.rb +4 -4
- data/lib/avromatic/model/types/union_type.rb +11 -8
- data/lib/avromatic/version.rb +1 -1
- metadata +62 -47
- data/.travis.yml +0 -23
- data/gemfiles/avro_patches_rails5_1.gemfile +0 -9
- data/lib/avromatic/patches.rb +0 -18
- data/lib/avromatic/patches/schema_validator_patch.rb +0 -39
data/lib/avromatic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avromatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify Engineering
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '6.
|
22
|
+
version: '6.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '6.
|
32
|
+
version: '6.2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '5.0'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '6.
|
42
|
+
version: '6.2'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '5.0'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '6.
|
52
|
+
version: '6.2'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: avro
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: 1.7.7
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
62
|
+
version: '1.11'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: 1.7.7
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '1.
|
72
|
+
version: '1.11'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: avro_schema_registry-client
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,6 +112,20 @@ dependencies:
|
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: appraisal
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
115
129
|
- !ruby/object:Gem::Dependency
|
116
130
|
name: avro-builder
|
117
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,6 +154,20 @@ dependencies:
|
|
140
154
|
- - ">="
|
141
155
|
- !ruby/object:Gem::Version
|
142
156
|
version: '1.11'
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: overcommit
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - '='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: 0.35.0
|
164
|
+
type: :development
|
165
|
+
prerelease: false
|
166
|
+
version_requirements: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - '='
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: 0.35.0
|
143
171
|
- !ruby/object:Gem::Dependency
|
144
172
|
name: rake
|
145
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,7 +197,7 @@ dependencies:
|
|
169
197
|
- !ruby/object:Gem::Version
|
170
198
|
version: '3.0'
|
171
199
|
- !ruby/object:Gem::Dependency
|
172
|
-
name:
|
200
|
+
name: rspec_junit_formatter
|
173
201
|
requirement: !ruby/object:Gem::Requirement
|
174
202
|
requirements:
|
175
203
|
- - ">="
|
@@ -183,21 +211,21 @@ dependencies:
|
|
183
211
|
- !ruby/object:Gem::Version
|
184
212
|
version: '0'
|
185
213
|
- !ruby/object:Gem::Dependency
|
186
|
-
name:
|
214
|
+
name: salsify_rubocop
|
187
215
|
requirement: !ruby/object:Gem::Requirement
|
188
216
|
requirements:
|
189
|
-
- - "
|
217
|
+
- - "~>"
|
190
218
|
- !ruby/object:Gem::Version
|
191
|
-
version:
|
219
|
+
version: 0.52.1.1
|
192
220
|
type: :development
|
193
221
|
prerelease: false
|
194
222
|
version_requirements: !ruby/object:Gem::Requirement
|
195
223
|
requirements:
|
196
|
-
- - "
|
224
|
+
- - "~>"
|
197
225
|
- !ruby/object:Gem::Version
|
198
|
-
version:
|
226
|
+
version: 0.52.1.1
|
199
227
|
- !ruby/object:Gem::Dependency
|
200
|
-
name:
|
228
|
+
name: simplecov
|
201
229
|
requirement: !ruby/object:Gem::Requirement
|
202
230
|
requirements:
|
203
231
|
- - ">="
|
@@ -211,33 +239,19 @@ dependencies:
|
|
211
239
|
- !ruby/object:Gem::Version
|
212
240
|
version: '0'
|
213
241
|
- !ruby/object:Gem::Dependency
|
214
|
-
name:
|
215
|
-
requirement: !ruby/object:Gem::Requirement
|
216
|
-
requirements:
|
217
|
-
- - '='
|
218
|
-
- !ruby/object:Gem::Version
|
219
|
-
version: 0.35.0
|
220
|
-
type: :development
|
221
|
-
prerelease: false
|
222
|
-
version_requirements: !ruby/object:Gem::Requirement
|
223
|
-
requirements:
|
224
|
-
- - '='
|
225
|
-
- !ruby/object:Gem::Version
|
226
|
-
version: 0.35.0
|
227
|
-
- !ruby/object:Gem::Dependency
|
228
|
-
name: salsify_rubocop
|
242
|
+
name: webmock
|
229
243
|
requirement: !ruby/object:Gem::Requirement
|
230
244
|
requirements:
|
231
|
-
- - "
|
245
|
+
- - ">="
|
232
246
|
- !ruby/object:Gem::Version
|
233
|
-
version: 0
|
247
|
+
version: '0'
|
234
248
|
type: :development
|
235
249
|
prerelease: false
|
236
250
|
version_requirements: !ruby/object:Gem::Requirement
|
237
251
|
requirements:
|
238
|
-
- - "
|
252
|
+
- - ">="
|
239
253
|
- !ruby/object:Gem::Version
|
240
|
-
version: 0
|
254
|
+
version: '0'
|
241
255
|
- !ruby/object:Gem::Dependency
|
242
256
|
name: sinatra
|
243
257
|
requirement: !ruby/object:Gem::Requirement
|
@@ -259,13 +273,13 @@ executables: []
|
|
259
273
|
extensions: []
|
260
274
|
extra_rdoc_files: []
|
261
275
|
files:
|
276
|
+
- ".circleci/config.yml"
|
262
277
|
- ".gitignore"
|
263
278
|
- ".overcommit.yml"
|
264
279
|
- ".rspec"
|
265
280
|
- ".rubocop.yml"
|
266
281
|
- ".ruby-gemset"
|
267
282
|
- ".ruby-version"
|
268
|
-
- ".travis.yml"
|
269
283
|
- Appraisals
|
270
284
|
- CHANGELOG.md
|
271
285
|
- Gemfile
|
@@ -276,18 +290,21 @@ files:
|
|
276
290
|
- bin/console
|
277
291
|
- bin/setup
|
278
292
|
- gemfiles/.bundle/config
|
279
|
-
- gemfiles/
|
280
|
-
- gemfiles/
|
293
|
+
- gemfiles/avro1_10_rails5_2.gemfile
|
294
|
+
- gemfiles/avro1_10_rails6_0.gemfile
|
295
|
+
- gemfiles/avro1_10_rails6_1.gemfile
|
296
|
+
- gemfiles/avro1_8_rails5_2.gemfile
|
297
|
+
- gemfiles/avro1_9_rails5_2.gemfile
|
298
|
+
- gemfiles/avro1_9_rails6_0.gemfile
|
299
|
+
- gemfiles/avro1_9_rails6_1.gemfile
|
281
300
|
- gemfiles/avro_patches_rails5_2.gemfile
|
282
301
|
- gemfiles/avro_patches_rails6_0.gemfile
|
283
|
-
- gemfiles/
|
284
|
-
- gemfiles/rails5_1.gemfile
|
285
|
-
- gemfiles/rails5_2.gemfile
|
286
|
-
- gemfiles/rails6_0.gemfile
|
302
|
+
- gemfiles/avro_patches_rails6_1.gemfile
|
287
303
|
- lib/avromatic.rb
|
288
304
|
- lib/avromatic/io.rb
|
289
305
|
- lib/avromatic/io/datum_reader.rb
|
290
306
|
- lib/avromatic/io/datum_writer.rb
|
307
|
+
- lib/avromatic/io/union_datum.rb
|
291
308
|
- lib/avromatic/messaging.rb
|
292
309
|
- lib/avromatic/model.rb
|
293
310
|
- lib/avromatic/model/attributes.rb
|
@@ -325,8 +342,6 @@ files:
|
|
325
342
|
- lib/avromatic/model/validation_error.rb
|
326
343
|
- lib/avromatic/model/value_object.rb
|
327
344
|
- lib/avromatic/model_registry.rb
|
328
|
-
- lib/avromatic/patches.rb
|
329
|
-
- lib/avromatic/patches/schema_validator_patch.rb
|
330
345
|
- lib/avromatic/railtie.rb
|
331
346
|
- lib/avromatic/rspec.rb
|
332
347
|
- lib/avromatic/version.rb
|
@@ -335,7 +350,7 @@ homepage: https://github.com/salsify/avromatic.git
|
|
335
350
|
licenses:
|
336
351
|
- MIT
|
337
352
|
metadata: {}
|
338
|
-
post_install_message:
|
353
|
+
post_install_message:
|
339
354
|
rdoc_options: []
|
340
355
|
require_paths:
|
341
356
|
- lib
|
@@ -350,8 +365,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
350
365
|
- !ruby/object:Gem::Version
|
351
366
|
version: '0'
|
352
367
|
requirements: []
|
353
|
-
rubygems_version: 3.0.
|
354
|
-
signing_key:
|
368
|
+
rubygems_version: 3.0.8
|
369
|
+
signing_key:
|
355
370
|
specification_version: 4
|
356
371
|
summary: Generate Ruby models from Avro schemas
|
357
372
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.6.3
|
4
|
-
- 2.5.5
|
5
|
-
- 2.4.6
|
6
|
-
before_script:
|
7
|
-
- bundle exec rubocop
|
8
|
-
gemfile:
|
9
|
-
- gemfiles/rails5_0.gemfile
|
10
|
-
- gemfiles/rails5_1.gemfile
|
11
|
-
- gemfiles/rails5_2.gemfile
|
12
|
-
- gemfiles/rails6_0.gemfile
|
13
|
-
- gemfiles/avro_patches_rails5_0.gemfile
|
14
|
-
- gemfiles/avro_patches_rails5_1.gemfile
|
15
|
-
- gemfiles/avro_patches_rails5_2.gemfile
|
16
|
-
- gemfiles/avro_patches_rails6_0.gemfile
|
17
|
-
script: bundle exec rspec
|
18
|
-
matrix:
|
19
|
-
exclude:
|
20
|
-
- rvm: 2.4.6
|
21
|
-
gemfile: gemfiles/rails6_0.gemfile
|
22
|
-
- rvm: 2.4.6
|
23
|
-
gemfile: gemfiles/avro_patches_rails6_0.gemfile
|
data/lib/avromatic/patches.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
loaded_avro_patches = begin
|
4
|
-
require 'avro-patches'
|
5
|
-
true
|
6
|
-
rescue LoadError
|
7
|
-
false
|
8
|
-
end
|
9
|
-
|
10
|
-
if loaded_avro_patches
|
11
|
-
require 'avromatic/patches/schema_validator_patch'
|
12
|
-
avro_patches_version = Gem::Version.new(AvroPatches::VERSION)
|
13
|
-
if avro_patches_version < Gem::Version.new('0.4.0')
|
14
|
-
Avro::SchemaValidator.singleton_class.prepend(Avromatic::Patches::SchemaValidatorPatch)
|
15
|
-
else
|
16
|
-
Avro::SchemaValidator.singleton_class.prepend(Avromatic::Patches::SchemaValidatorPatchV040)
|
17
|
-
end
|
18
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avromatic
|
4
|
-
module Patches
|
5
|
-
module SchemaValidatorPatch
|
6
|
-
# This method replaces validate_recursive in AvroPatches::LogicalTypes::SchemaValidatorPatch
|
7
|
-
# to enable validating datums that contain an encoding provider.
|
8
|
-
def validate_recursive(expected_schema, logical_datum, path, result, encoded = false)
|
9
|
-
datum = resolve_datum(expected_schema, logical_datum, encoded)
|
10
|
-
case expected_schema.type_sym
|
11
|
-
when :record, :error, :request
|
12
|
-
if datum.is_a?(Hash) && datum.key?(Avromatic::IO::ENCODING_PROVIDER)
|
13
|
-
return if expected_schema.sha256_resolution_fingerprint ==
|
14
|
-
datum[Avromatic::IO::ENCODING_PROVIDER].value_avro_schema.sha256_resolution_fingerprint
|
15
|
-
raise Avro::SchemaValidator::ValidationError
|
16
|
-
end
|
17
|
-
end
|
18
|
-
super(expected_schema, logical_datum, path, result, encoded)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module SchemaValidatorPatchV040
|
23
|
-
# This method replaces validate_recursive in AvroPatches::LogicalTypes::SchemaValidatorPatch
|
24
|
-
# to enable validating datums that contain an encoding provider.
|
25
|
-
def validate_recursive(expected_schema, logical_datum, path, result, options = {})
|
26
|
-
datum = resolve_datum(expected_schema, logical_datum, options[:encoded])
|
27
|
-
case expected_schema.type_sym
|
28
|
-
when :record, :error, :request
|
29
|
-
if datum.is_a?(Hash) && datum.key?(Avromatic::IO::ENCODING_PROVIDER)
|
30
|
-
return if expected_schema.sha256_resolution_fingerprint ==
|
31
|
-
datum[Avromatic::IO::ENCODING_PROVIDER].value_avro_schema.sha256_resolution_fingerprint
|
32
|
-
raise Avro::SchemaValidator::ValidationError
|
33
|
-
end
|
34
|
-
end
|
35
|
-
super(expected_schema, logical_datum, path, result, options)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|