avrolution 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +5 -0
- data/avrolution.gemspec +1 -1
- data/lib/avrolution/compatibility_check.rb +6 -5
- data/lib/avrolution/version.rb +1 -1
- data/lib/generators/avrolution/install_generator.rb +11 -0
- data/lib/generators/avrolution/templates/avro_compatibility_breaks.txt +20 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbf0fc83c28860289887a88b8e789f5217f2c365
|
4
|
+
data.tar.gz: 54e25410dffeb032b364f5cd0568c679b56eae5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33fbbf8d76a0f753d6271d20ef08cf3dff2700f7b2b266fe4c3fb3f7e4748ae0bf529afda8411ad37b25c2460f6acf8a5bc2f0cf59191121854ae4512dcbbb7e
|
7
|
+
data.tar.gz: ad9c8d2f67de145deafb60ee1b7199bb64db193b78ccdda78c938d843b0b40441609c69c7e5a746fc8dd899aa6b0e579907ca1344b08527d881b147f46b38605
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
# avrolution
|
2
2
|
|
3
|
+
## v0.2.0
|
4
|
+
- Add Rails generator to create `avro_compatibility_breaks.txt` file.
|
5
|
+
- Replace the dependency on `avromatic` with `avro_schema_registry-client`.
|
6
|
+
- Reverse the identification of BACKWARD and FORWARD compatibility levels
|
7
|
+
with the latest registered version.
|
8
|
+
|
3
9
|
## v0.1.0
|
4
10
|
- Add rake task to check the compatibility of schemas against a schema registry.
|
data/README.md
CHANGED
@@ -24,6 +24,11 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
$ gem install avrolution
|
26
26
|
|
27
|
+
Within a Rails project, create an `avro_compatibility_breaks.txt` file at
|
28
|
+
`Rails.root` by running:
|
29
|
+
|
30
|
+
$ rails generate avrolution:install
|
31
|
+
|
27
32
|
## Configuration
|
28
33
|
|
29
34
|
The gem supports the following configuration:
|
data/avrolution.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency 'simplecov'
|
37
37
|
|
38
38
|
spec.add_runtime_dependency 'avro-salsify-fork', '1.9.0.5'
|
39
|
-
spec.add_runtime_dependency '
|
39
|
+
spec.add_runtime_dependency 'avro_schema_registry-client'
|
40
40
|
spec.add_runtime_dependency 'diffy'
|
41
41
|
spec.add_runtime_dependency 'private_attr'
|
42
42
|
spec.add_runtime_dependency 'activesupport'
|
@@ -1,6 +1,7 @@
|
|
1
|
+
require 'avro-resolution_canonical_form'
|
1
2
|
require 'private_attr'
|
2
3
|
require 'diffy'
|
3
|
-
require '
|
4
|
+
require 'avro_schema_registry-client'
|
4
5
|
|
5
6
|
module Avrolution
|
6
7
|
class CompatibilityCheck
|
@@ -77,8 +78,8 @@ module Avrolution
|
|
77
78
|
def report_incompatibility(json, schema, fullname, fingerprint)
|
78
79
|
last_json = schema_registry.subject_version(fullname)['schema']
|
79
80
|
last_schema = Avro::Schema.parse(last_json)
|
80
|
-
backward =
|
81
|
-
forward =
|
81
|
+
backward = schema.read?(last_schema)
|
82
|
+
forward = last_schema.read?(schema)
|
82
83
|
compatibility_with_last = if backward && forward
|
83
84
|
FULL
|
84
85
|
elsif backward
|
@@ -101,8 +102,8 @@ module Avrolution
|
|
101
102
|
end
|
102
103
|
|
103
104
|
def build_schema_registry
|
104
|
-
|
105
|
-
|
105
|
+
AvroSchemaRegistry::Client.new(Avrolution.compatibility_schema_registry_url,
|
106
|
+
logger: Avrolution.logger)
|
106
107
|
end
|
107
108
|
end
|
108
109
|
end
|
data/lib/avrolution/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module Avrolution
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
source_paths << File.join(__dir__, 'templates')
|
6
|
+
|
7
|
+
def create_compatibility_breaks_file
|
8
|
+
copy_file('avro_compatibility_breaks.txt')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file is used to declare compatibility breaks for Avro JSON schemas.
|
2
|
+
# It is consulted when running the avro:check_compatibility rake task
|
3
|
+
# and during the deployment of new schema versions.
|
4
|
+
#
|
5
|
+
# Entries in the file have the following format:
|
6
|
+
#
|
7
|
+
# name fingerprint [with_compatibility] [after_compatibility]
|
8
|
+
#
|
9
|
+
# name: The full name of the schema, including namespace.
|
10
|
+
#
|
11
|
+
# fingerprint: The SHA256 resolution fingerprint for the schema in hex.
|
12
|
+
#
|
13
|
+
# with_compatibility: The compatibility level to check against, and the level
|
14
|
+
# to use during deployment. Defaults to NONE.
|
15
|
+
#
|
16
|
+
# after_compatibility: Optional compatibility level to set after a new schema
|
17
|
+
# version is deployed.
|
18
|
+
#
|
19
|
+
# See https://github.com/salisfy/avrolution for more information.
|
20
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avrolution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -123,19 +123,19 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.9.0.5
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: avro_schema_registry-client
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0
|
131
|
+
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: diffy
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -225,6 +225,8 @@ files:
|
|
225
225
|
- lib/avrolution/rake/check_compatibility_task.rb
|
226
226
|
- lib/avrolution/rake/rails_avrolution.rake
|
227
227
|
- lib/avrolution/version.rb
|
228
|
+
- lib/generators/avrolution/install_generator.rb
|
229
|
+
- lib/generators/avrolution/templates/avro_compatibility_breaks.txt
|
228
230
|
homepage: https://github.com/salsify/avrolution
|
229
231
|
licenses:
|
230
232
|
- MIT
|