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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e79aa3bc80d548e2c6556c05208e1ac2b6b47889
4
- data.tar.gz: b84ac201fea59bb1cd68fe70cf4874ba8252acbf
3
+ metadata.gz: ed60cb5d2757a33263b574ba6346fc9665b84548
4
+ data.tar.gz: 2b36545e5fc8dcb16c5aa93bb1e83fd1248e1b28
5
5
  SHA512:
6
- metadata.gz: a085676807b8837acb53c6d66a5cd53cc2a0e4bad3055892abdd03c59fdf02a9b85cabeee91b81fc6a75c3e428b4a0f7bef6941c9034a8f646b30353c1cf178f
7
- data.tar.gz: 73404b334dfec4168f3cebbe7dc07266be9ecf716ce5c0d3ea9a0086e1d2919cbe99766b743e12f7596a1a9d91e6d6ccbe3868b5c8529f898d95d39938f1a75e
6
+ metadata.gz: 6727d406d14b6767422de730149d85abd1a819c773267c90a467d89a4233da76d8140bcefffbd67a3049a464e4072e3f201d685d0033f032cdd86b821523b133
7
+ data.tar.gz: a5960d92f14696c5fbb22c3ec80f245cdc3da3a8b1b50a5b39eaf919b68cc7786499d48bdffb87feffa6715dd183f6584811ae4e09c659783b52ac68dab9c826
data/.gitignore CHANGED
@@ -7,3 +7,5 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .idea
11
+ *.iml
@@ -1,5 +1,8 @@
1
1
  # avro-patches
2
2
 
3
+ ## v0.3.4
4
+ - Allow promotion of nested records to optional
5
+
3
6
  ## v0.3.3
4
7
  - Restore basic validation of records, arrays, and maps before writing.
5
8
  - Add validation to protect against nil value for map.
data/bin/setup CHANGED
@@ -3,6 +3,7 @@ set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -v
5
5
 
6
+ gem install bundler
6
7
  bundle update
7
8
 
8
9
  overcommit --install
@@ -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
- writer_fields_hash = writers_schema.fields_hash
122
- readers_schema.fields.each do |field|
123
- if writer_fields_hash.key?(field.name)
124
- return false unless full_match_schemas(writer_fields_hash[field.name].type, field.type)
125
- else
126
- return false unless field.default?
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
- return true
138
+ return true
139
+ end
131
140
  end
132
141
 
133
142
  def recursion_in_progress?(writers_schema, readers_schema)
@@ -1,3 +1,3 @@
1
1
  module AvroPatches
2
- VERSION = '0.3.3'.freeze
2
+ VERSION = '0.3.4'.freeze
3
3
  end
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.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-02-02 00:00:00.000000000 Z
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.13
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