avro-patches 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +3 -0
- data/bin/setup +1 -0
- data/lib/avro-patches/schema_compatibility/schema_compatibility.rb +17 -8
- data/lib/avro-patches/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed60cb5d2757a33263b574ba6346fc9665b84548
|
4
|
+
data.tar.gz: 2b36545e5fc8dcb16c5aa93bb1e83fd1248e1b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6727d406d14b6767422de730149d85abd1a819c773267c90a467d89a4233da76d8140bcefffbd67a3049a464e4072e3f201d685d0033f032cdd86b821523b133
|
7
|
+
data.tar.gz: a5960d92f14696c5fbb22c3ec80f245cdc3da3a8b1b50a5b39eaf919b68cc7786499d48bdffb87feffa6715dd183f6584811ae4e09c659783b52ac68dab9c826
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/bin/setup
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
module Avro
|
2
|
+
|
3
|
+
# see http://avro.apache.org/docs/current/spec.html#Schema+Resolution for what this should do
|
2
4
|
module SchemaCompatibility
|
3
5
|
def self.can_read?(writers_schema, readers_schema)
|
4
6
|
Checker.new.can_read?(writers_schema, readers_schema)
|
@@ -106,6 +108,7 @@ module Avro
|
|
106
108
|
end
|
107
109
|
end
|
108
110
|
|
111
|
+
# reader is a union
|
109
112
|
def match_union_schemas(writers_schema, readers_schema)
|
110
113
|
raise 'readers_schema must be a union' unless readers_schema.type_sym == :union
|
111
114
|
|
@@ -117,17 +120,23 @@ module Avro
|
|
117
120
|
end
|
118
121
|
end
|
119
122
|
|
123
|
+
# reader is a record
|
120
124
|
def match_record_schemas(writers_schema, readers_schema)
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
125
|
+
case writers_schema.type_sym
|
126
|
+
when :union
|
127
|
+
return false
|
128
|
+
else
|
129
|
+
writer_fields_hash = writers_schema.fields_hash
|
130
|
+
readers_schema.fields.each do |field|
|
131
|
+
if writer_fields_hash.key?(field.name)
|
132
|
+
return false unless full_match_schemas(writer_fields_hash[field.name].type, field.type)
|
133
|
+
else
|
134
|
+
return false unless field.default?
|
135
|
+
end
|
127
136
|
end
|
128
|
-
end
|
129
137
|
|
130
|
-
|
138
|
+
return true
|
139
|
+
end
|
131
140
|
end
|
132
141
|
|
133
142
|
def recursion_in_progress?(writers_schema, readers_schema)
|
data/lib/avro-patches/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avro-patches
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.6.
|
143
|
+
rubygems_version: 2.6.14
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Patches for the official Apache Avro Ruby implementation
|