avromatic 0.21.0 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/avromatic.gemspec +2 -1
- data/lib/avromatic/io/datum_reader.rb +10 -1
- data/lib/avromatic/model/attributes.rb +3 -0
- data/lib/avromatic/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0abfee6a816f939b561c744c5ac49c5a6b2d484e
|
4
|
+
data.tar.gz: 1d43dfd2df53bf40b0f571cdce873bc5055c3837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 802e7634ae80d35338e596db5bba3155d1378a533921716b9e14f0685ae8f94cc7d7f578820c55f16d1c1cfeb5a8c7f1bb0f2e875001732856fbc97ef3d7a92f
|
7
|
+
data.tar.gz: 2fa0d4b40bbafa7f15627f877536d72d9413dee8c5009f0d46ac00dd78d8efc7ed9be234d00fc069e70ed3b4baf0d5a1087234405d1717371820c2db15aef55f
|
data/CHANGELOG.md
CHANGED
data/avromatic.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'avromatic/version'
|
@@ -34,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
34
35
|
spec.add_development_dependency 'avro-builder', '>= 0.12.0'
|
35
36
|
# For AvroSchemaRegistry::FakeServer
|
36
37
|
spec.add_development_dependency 'sinatra'
|
37
|
-
spec.add_development_dependency 'salsify_rubocop', '~> 0.
|
38
|
+
spec.add_development_dependency 'salsify_rubocop', '~> 0.48.0'
|
38
39
|
spec.add_development_dependency 'overcommit', '0.35.0'
|
39
40
|
spec.add_development_dependency 'appraisal'
|
40
41
|
end
|
@@ -20,7 +20,16 @@ module Avromatic
|
|
20
20
|
self.class.match_schemas(writers_schema, s)
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
optional = readers_schema.schemas.first.type_sym == :null
|
24
|
+
union_info = if readers_schema.schemas.size == 2 && optional
|
25
|
+
# Avromatic does not treat the union of null and 1 other type as a union
|
26
|
+
{}
|
27
|
+
elsif optional
|
28
|
+
# Avromatic does not treat the null of an optional field as part of the union
|
29
|
+
{ UNION_MEMBER_INDEX => rs_index - 1 }
|
30
|
+
else
|
31
|
+
{ UNION_MEMBER_INDEX => rs_index }
|
32
|
+
end
|
24
33
|
|
25
34
|
return read_data(writers_schema, readers_schema.schemas[rs_index], decoder, union_info) if rs_index
|
26
35
|
raise Avro::IO::SchemaMatchException.new(writers_schema, readers_schema)
|
@@ -144,6 +144,9 @@ module Avromatic
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def union_field_class(field_type)
|
147
|
+
null_index = field_type.schemas.index { |schema| schema.type_sym == :null }
|
148
|
+
raise 'a null type in a union must be the first member' if null_index && null_index > 0
|
149
|
+
|
147
150
|
field_classes = field_type.schemas.reject { |schema| schema.type_sym == :null }
|
148
151
|
.map { |schema| avro_field_class(schema) }
|
149
152
|
|
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: 0.21.
|
4
|
+
version: 0.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|
@@ -210,14 +210,14 @@ dependencies:
|
|
210
210
|
requirements:
|
211
211
|
- - "~>"
|
212
212
|
- !ruby/object:Gem::Version
|
213
|
-
version: 0.
|
213
|
+
version: 0.48.0
|
214
214
|
type: :development
|
215
215
|
prerelease: false
|
216
216
|
version_requirements: !ruby/object:Gem::Requirement
|
217
217
|
requirements:
|
218
218
|
- - "~>"
|
219
219
|
- !ruby/object:Gem::Version
|
220
|
-
version: 0.
|
220
|
+
version: 0.48.0
|
221
221
|
- !ruby/object:Gem::Dependency
|
222
222
|
name: overcommit
|
223
223
|
requirement: !ruby/object:Gem::Requirement
|