avromatic 0.32.0 → 0.33.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: db83c88fe3f792f10b7cde907caa0b77e2a0ce76
4
- data.tar.gz: 2f27e065376ae2167ec50baca0907fc7fa15decd
2
+ SHA256:
3
+ metadata.gz: 1870605ba70504e621a7c04a4d4a95ff32d1b83764dc6c6375e5feba60daf4fc
4
+ data.tar.gz: 3afe45d9fcf729f6ea2e9f203a051911cd3e5444b62040b8066e0942de8593cc
5
5
  SHA512:
6
- metadata.gz: 16328ab60efa5cc65c32d384c1e2fecc7ebe4d7b92e4b36eb378bce0f6a1e053118fb96628be4cf1ab9bf53a488bdaf9ad5fad3d1fad3e26ecfb977f39ed1d2e
7
- data.tar.gz: 51c155c02374503525f84c568caabe79a3b86d215e1c83cb1c97ede6d7e9b4571d017989e088a3502fb3ad547d8b6deab80f5484b6f3f90d51e2d66bc9af5d77
6
+ metadata.gz: 7966a6aa7a9e9387dbdf5bc8b6c735ae54f5dd801a26d6b824533c3fdb76bc5a0f4ce038cc01250fb49925d3dafaccf1eec2b4008a0b3481435e5f00e8d5b64d
7
+ data.tar.gz: 3917130bb19f73f597bed3701148c1150f80579bbe2616e1c126f8f00387f261bf05980bb447d8ed7604b4652fd7bdac4ad26dfadfc1168f5300cc816cfd204d
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ avromatic
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/.travis.yml CHANGED
@@ -3,17 +3,15 @@ rvm:
3
3
  - 2.5.1
4
4
  - 2.4.4
5
5
  - 2.3.5
6
- - 2.2.8
7
6
  before_script:
8
7
  - bundle exec appraisal install --jobs=3
9
8
  script:
10
9
  - bundle exec rubocop
11
- - bundle exec appraisal rails4_1 rake spec
12
- - bundle exec appraisal rails4_2 rake spec
13
- - bundle exec appraisal rails5_0 rake spec
14
- - bundle exec appraisal rails5_1 rake spec
15
- - bundle exec appraisal rails5_2 rake spec
16
- - bundle exec appraisal avro-patches-4_1 rake spec
17
- - bundle exec appraisal avro-patches-5_0 rake spec
18
- - bundle exec appraisal avro-patches-5_1 rake spec
19
- - bundle exec appraisal avro-patches-5_2 rake spec
10
+ - bundle exec appraisal rails5_0 rspec
11
+ - bundle exec appraisal rails5_1 rspec
12
+ - bundle exec appraisal rails5_2 rspec
13
+ - bundle exec appraisal avro-patches-5_0 rspec
14
+ - bundle exec appraisal avro-patches-0_3_4-rails5_1 rspec
15
+ - bundle exec appraisal avro-patches-0_3_4-rails5_2 rspec
16
+ - bundle exec appraisal avro-patches-rails5_1 rspec
17
+ - bundle exec appraisal avro-patches-rails5_2 rspec
data/Appraisals CHANGED
@@ -1,15 +1,3 @@
1
- appraise 'rails4_1' do
2
- gem 'avro', '1.8.2'
3
- gem 'activesupport', '~> 4.1.16'
4
- gem 'activemodel', '~> 4.1.16'
5
- end
6
-
7
- appraise 'rails4_2' do
8
- gem 'avro', '1.8.2'
9
- gem 'activesupport', '~> 4.2.7.1'
10
- gem 'activemodel', '~> 4.2.7.1'
11
- end
12
-
13
1
  appraise 'rails5_0' do
14
2
  gem 'avro', '1.8.2'
15
3
  gem 'activesupport', '~> 5.0.6'
@@ -28,26 +16,32 @@ appraise 'rails5_2' do
28
16
  gem 'activemodel', '~> 5.2.0'
29
17
  end
30
18
 
31
- appraise 'avro-patches-4_1' do
32
- gem 'avro-patches'
33
- gem 'activesupport', '~> 4.1.16'
34
- gem 'activemodel', '~> 4.1.16'
35
- end
36
-
37
19
  appraise 'avro-patches-5_0' do
38
20
  gem 'avro-patches'
39
21
  gem 'activesupport', '~> 5.0.6'
40
22
  gem 'activemodel', '~> 5.0.6'
41
23
  end
42
24
 
43
- appraise 'avro-patches-5_1' do
44
- gem 'avro-patches'
25
+ appraise 'avro-patches-0_3_4-rails5_1' do
26
+ gem 'avro-patches', '0.3.4'
45
27
  gem 'activesupport', '~> 5.1.4'
46
28
  gem 'activemodel', '~> 5.1.4'
47
29
  end
48
30
 
49
- appraise 'avro-patches-5_2' do
50
- gem 'avro-patches'
31
+ appraise 'avro-patches-0_3_4-rails5_2' do
32
+ gem 'avro-patches', '0.3.4'
33
+ gem 'activesupport', '~> 5.2.0'
34
+ gem 'activemodel', '~> 5.2.0'
35
+ end
36
+
37
+ appraise 'avro-patches-rails5_1' do
38
+ gem 'avro-patches', '>= 0.4.0'
39
+ gem 'activesupport', '~> 5.1.4'
40
+ gem 'activemodel', '~> 5.1.4'
41
+ end
42
+
43
+ appraise 'avro-patches-rails5_2' do
44
+ gem 'avro-patches', '>= 0.4.0'
51
45
  gem 'activesupport', '~> 5.2.0'
52
46
  gem 'activemodel', '~> 5.2.0'
53
47
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # avromatic changelog
2
2
 
3
+ ## v0.33.0
4
+ - Fix compatibility with avro-patches v0.4.0.
5
+
3
6
  ## v0.32.0
4
7
  - Improve partial assignment using a hash for records outside of unions.
5
8
  - Prevent invalid types from being assigned to primitives in unions.
data/README.md CHANGED
@@ -207,7 +207,7 @@ The `ModelRegistry` can be customized to remove a namespace prefix:
207
207
 
208
208
  ```ruby
209
209
  Avromatic.nested_models =
210
- Avromatic::ModelRegistry.new(remove_namespace_prefix: 'com.my_company'
210
+ Avromatic::ModelRegistry.new(remove_namespace_prefix: 'com.my_company')
211
211
  ```
212
212
 
213
213
  The `:remove_namespace_prefix` value can be a string or a regexp.
data/avromatic.gemspec CHANGED
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  lib = File.expand_path('../lib', __FILE__)
4
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
3
  require 'avromatic/version'
@@ -20,22 +18,22 @@ Gem::Specification.new do |spec|
20
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
19
  spec.require_paths = ['lib']
22
20
 
23
- spec.add_runtime_dependency 'avro', '>= 1.7.7'
24
- spec.add_runtime_dependency 'virtus'
25
- spec.add_runtime_dependency 'activesupport', '>= 4.1', '< 5.3'
26
21
  spec.add_runtime_dependency 'activemodel', '>= 4.1', '< 5.3'
27
- spec.add_runtime_dependency 'avro_turf'
22
+ spec.add_runtime_dependency 'activesupport', '>= 4.1', '< 5.3'
23
+ spec.add_runtime_dependency 'avro', '>= 1.7.7'
28
24
  spec.add_runtime_dependency 'avro_schema_registry-client', '>= 0.3.0'
25
+ spec.add_runtime_dependency 'avro_turf'
26
+ spec.add_runtime_dependency 'virtus'
29
27
 
28
+ spec.add_development_dependency 'avro-builder', '>= 0.12.0'
30
29
  spec.add_development_dependency 'bundler', '~> 1.11'
31
30
  spec.add_development_dependency 'rake', '~> 10.0'
32
31
  spec.add_development_dependency 'rspec', '~> 3.0'
33
32
  spec.add_development_dependency 'simplecov'
34
33
  spec.add_development_dependency 'webmock'
35
- spec.add_development_dependency 'avro-builder', '>= 0.12.0'
36
34
  # For AvroSchemaRegistry::FakeServer
37
- spec.add_development_dependency 'sinatra'
38
- spec.add_development_dependency 'salsify_rubocop', '~> 0.48.0'
39
- spec.add_development_dependency 'overcommit', '0.35.0'
40
35
  spec.add_development_dependency 'appraisal'
36
+ spec.add_development_dependency 'overcommit', '0.35.0'
37
+ spec.add_development_dependency 'salsify_rubocop', '~> 0.52.1.1'
38
+ spec.add_development_dependency 'sinatra'
41
39
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "avro-patches"
5
+ gem "avro-patches", "0.3.4"
6
6
  gem "activesupport", "~> 5.1.4"
7
7
  gem "activemodel", "~> 5.1.4"
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "avro-patches"
5
+ gem "avro-patches", "0.3.4"
6
6
  gem "activesupport", "~> 5.2.0"
7
7
  gem "activemodel", "~> 5.2.0"
8
8
 
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "avro-patches", ">= 0.4.0"
6
+ gem "activesupport", "~> 5.1.4"
7
+ gem "activemodel", "~> 5.1.4"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "avro-patches", ">= 0.4.0"
6
+ gem "activesupport", "~> 5.2.0"
7
+ gem "activemodel", "~> 5.2.0"
8
+
9
+ gemspec path: "../"
@@ -83,3 +83,4 @@ module Avromatic
83
83
  end
84
84
  end
85
85
  end
86
+ # rubocop:enable Style/WhenThen
@@ -53,7 +53,7 @@ module Avromatic
53
53
  elsif member_attribute.coerced?(coerced)
54
54
  coerced
55
55
  end
56
- rescue
56
+ rescue StandardError
57
57
  nil
58
58
  end
59
59
 
@@ -22,7 +22,7 @@ module Avromatic
22
22
  end
23
23
 
24
24
  module ClassMethods
25
- def recursive_serialize(value, name: nil, member_types: nil, strict: false)
25
+ def recursive_serialize(value, name: nil, member_types: nil, strict: false) # rubocop:disable Lint/ShadowedArgument
26
26
  member_types = attribute_member_types(name) if name
27
27
  member_types ||= EMPTY_ARRAY
28
28
 
@@ -17,7 +17,7 @@ module Avromatic
17
17
  end
18
18
 
19
19
  def to_s
20
- format('#<%s:0x00%x>', self.class.name, object_id.abs * 2)
20
+ format('#<%<class_name>s:0x00%<identifier>x>', class_name: self.class.name, identifier: object_id.abs * 2)
21
21
  end
22
22
  end
23
23
  end
@@ -16,5 +16,22 @@ module Avromatic
16
16
  super(expected_schema, logical_datum, path, result, encoded)
17
17
  end
18
18
  end
19
+
20
+ module SchemaValidatorPatchV040
21
+ # This method replaces validate_recursive in AvroPatches::LogicalTypes::SchemaValidatorPatch
22
+ # to enable validating datums that contain an encoding provider.
23
+ def validate_recursive(expected_schema, logical_datum, path, result, options = {})
24
+ datum = resolve_datum(expected_schema, logical_datum, options[:encoded])
25
+ case expected_schema.type_sym
26
+ when :record, :error, :request
27
+ if datum.is_a?(Hash) && datum.key?(Avromatic::IO::ENCODING_PROVIDER)
28
+ return if expected_schema.sha256_resolution_fingerprint ==
29
+ datum[Avromatic::IO::ENCODING_PROVIDER].value_avro_schema.sha256_resolution_fingerprint
30
+ raise Avro::SchemaValidator::ValidationError
31
+ end
32
+ end
33
+ super(expected_schema, logical_datum, path, result, options)
34
+ end
35
+ end
19
36
  end
20
37
  end
@@ -7,5 +7,10 @@ loaded_avro_patches = begin
7
7
 
8
8
  if loaded_avro_patches
9
9
  require 'avromatic/patches/schema_validator_patch'
10
- Avro::SchemaValidator.singleton_class.prepend(Avromatic::Patches::SchemaValidatorPatch)
10
+ avro_patches_version = Gem::Version.new(AvroPatches::VERSION)
11
+ if avro_patches_version < Gem::Version.new('0.4.0')
12
+ Avro::SchemaValidator.singleton_class.prepend(Avromatic::Patches::SchemaValidatorPatch)
13
+ else
14
+ Avro::SchemaValidator.singleton_class.prepend(Avromatic::Patches::SchemaValidatorPatchV040)
15
+ end
11
16
  end
@@ -1,3 +1,3 @@
1
1
  module Avromatic
2
- VERSION = '0.32.0'.freeze
2
+ VERSION = '0.33.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,43 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avromatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.0
4
+ version: 0.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-26 00:00:00.000000000 Z
11
+ date: 2018-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: avro
14
+ name: activemodel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.7
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 1.7.7
27
- - !ruby/object:Gem::Dependency
28
- name: virtus
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
19
+ version: '4.1'
20
+ - - "<"
32
21
  - !ruby/object:Gem::Version
33
- version: '0'
22
+ version: '5.3'
34
23
  type: :runtime
35
24
  prerelease: false
36
25
  version_requirements: !ruby/object:Gem::Requirement
37
26
  requirements:
38
27
  - - ">="
39
28
  - !ruby/object:Gem::Version
40
- version: '0'
29
+ version: '4.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.3'
41
33
  - !ruby/object:Gem::Dependency
42
34
  name: activesupport
43
35
  requirement: !ruby/object:Gem::Requirement
@@ -59,25 +51,33 @@ dependencies:
59
51
  - !ruby/object:Gem::Version
60
52
  version: '5.3'
61
53
  - !ruby/object:Gem::Dependency
62
- name: activemodel
54
+ name: avro
63
55
  requirement: !ruby/object:Gem::Requirement
64
56
  requirements:
65
57
  - - ">="
66
58
  - !ruby/object:Gem::Version
67
- version: '4.1'
68
- - - "<"
69
- - !ruby/object:Gem::Version
70
- version: '5.3'
59
+ version: 1.7.7
71
60
  type: :runtime
72
61
  prerelease: false
73
62
  version_requirements: !ruby/object:Gem::Requirement
74
63
  requirements:
75
64
  - - ">="
76
65
  - !ruby/object:Gem::Version
77
- version: '4.1'
78
- - - "<"
66
+ version: 1.7.7
67
+ - !ruby/object:Gem::Dependency
68
+ name: avro_schema_registry-client
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
79
72
  - !ruby/object:Gem::Version
80
- version: '5.3'
73
+ version: 0.3.0
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.3.0
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: avro_turf
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -93,19 +93,33 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  - !ruby/object:Gem::Dependency
96
- name: avro_schema_registry-client
96
+ name: virtus
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: 0.3.0
101
+ version: '0'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 0.3.0
108
+ version: '0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: avro-builder
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 0.12.0
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 0.12.0
109
123
  - !ruby/object:Gem::Dependency
110
124
  name: bundler
111
125
  requirement: !ruby/object:Gem::Requirement
@@ -177,63 +191,49 @@ dependencies:
177
191
  - !ruby/object:Gem::Version
178
192
  version: '0'
179
193
  - !ruby/object:Gem::Dependency
180
- name: avro-builder
194
+ name: appraisal
181
195
  requirement: !ruby/object:Gem::Requirement
182
196
  requirements:
183
197
  - - ">="
184
198
  - !ruby/object:Gem::Version
185
- version: 0.12.0
199
+ version: '0'
186
200
  type: :development
187
201
  prerelease: false
188
202
  version_requirements: !ruby/object:Gem::Requirement
189
203
  requirements:
190
204
  - - ">="
191
205
  - !ruby/object:Gem::Version
192
- version: 0.12.0
206
+ version: '0'
193
207
  - !ruby/object:Gem::Dependency
194
- name: sinatra
208
+ name: overcommit
195
209
  requirement: !ruby/object:Gem::Requirement
196
210
  requirements:
197
- - - ">="
211
+ - - '='
198
212
  - !ruby/object:Gem::Version
199
- version: '0'
213
+ version: 0.35.0
200
214
  type: :development
201
215
  prerelease: false
202
216
  version_requirements: !ruby/object:Gem::Requirement
203
217
  requirements:
204
- - - ">="
218
+ - - '='
205
219
  - !ruby/object:Gem::Version
206
- version: '0'
220
+ version: 0.35.0
207
221
  - !ruby/object:Gem::Dependency
208
222
  name: salsify_rubocop
209
223
  requirement: !ruby/object:Gem::Requirement
210
224
  requirements:
211
225
  - - "~>"
212
226
  - !ruby/object:Gem::Version
213
- version: 0.48.0
227
+ version: 0.52.1.1
214
228
  type: :development
215
229
  prerelease: false
216
230
  version_requirements: !ruby/object:Gem::Requirement
217
231
  requirements:
218
232
  - - "~>"
219
233
  - !ruby/object:Gem::Version
220
- version: 0.48.0
234
+ version: 0.52.1.1
221
235
  - !ruby/object:Gem::Dependency
222
- name: overcommit
223
- requirement: !ruby/object:Gem::Requirement
224
- requirements:
225
- - - '='
226
- - !ruby/object:Gem::Version
227
- version: 0.35.0
228
- type: :development
229
- prerelease: false
230
- version_requirements: !ruby/object:Gem::Requirement
231
- requirements:
232
- - - '='
233
- - !ruby/object:Gem::Version
234
- version: 0.35.0
235
- - !ruby/object:Gem::Dependency
236
- name: appraisal
236
+ name: sinatra
237
237
  requirement: !ruby/object:Gem::Requirement
238
238
  requirements:
239
239
  - - ">="
@@ -257,6 +257,8 @@ files:
257
257
  - ".overcommit.yml"
258
258
  - ".rspec"
259
259
  - ".rubocop.yml"
260
+ - ".ruby-gemset"
261
+ - ".ruby-version"
260
262
  - ".travis.yml"
261
263
  - Appraisals
262
264
  - CHANGELOG.md
@@ -268,12 +270,11 @@ files:
268
270
  - bin/console
269
271
  - bin/setup
270
272
  - gemfiles/.bundle/config
271
- - gemfiles/avro_patches_4_1.gemfile
273
+ - gemfiles/avro_patches_0_3_4_rails5_1.gemfile
274
+ - gemfiles/avro_patches_0_3_4_rails5_2.gemfile
272
275
  - gemfiles/avro_patches_5_0.gemfile
273
- - gemfiles/avro_patches_5_1.gemfile
274
- - gemfiles/avro_patches_5_2.gemfile
275
- - gemfiles/rails4_1.gemfile
276
- - gemfiles/rails4_2.gemfile
276
+ - gemfiles/avro_patches_rails5_1.gemfile
277
+ - gemfiles/avro_patches_rails5_2.gemfile
277
278
  - gemfiles/rails5_0.gemfile
278
279
  - gemfiles/rails5_1.gemfile
279
280
  - gemfiles/rails5_2.gemfile
@@ -333,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
334
  version: '0'
334
335
  requirements: []
335
336
  rubyforge_project:
336
- rubygems_version: 2.6.13
337
+ rubygems_version: 2.7.6
337
338
  signing_key:
338
339
  specification_version: 4
339
340
  summary: Generate Ruby models from Avro schemas
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "avro-patches"
6
- gem "activesupport", "~> 4.1.16"
7
- gem "activemodel", "~> 4.1.16"
8
-
9
- gemspec path: "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "avro", "1.8.2"
6
- gem "activesupport", "~> 4.1.16"
7
- gem "activemodel", "~> 4.1.16"
8
-
9
- gemspec path: "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "avro", "1.8.2"
6
- gem "activesupport", "~> 4.2.7.1"
7
- gem "activemodel", "~> 4.2.7.1"
8
-
9
- gemspec path: "../"