avro-builder 0.17.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +77 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/Appraisals +4 -21
- data/CHANGELOG.md +7 -0
- data/README.md +2 -14
- data/avro-builder.gemspec +6 -2
- data/gemfiles/{avro_1.10.0.gemfile → avro_1.10.gemfile} +1 -1
- data/gemfiles/{avro_1.9.1.gemfile → avro_1.9.gemfile} +1 -1
- data/lib/avro/builder/dsl.rb +2 -1
- data/lib/avro/builder/rake/avro_generate_task.rb +1 -0
- data/lib/avro/builder/types/record_type.rb +2 -1
- data/lib/avro/builder/version.rb +1 -1
- metadata +39 -16
- data/.travis.yml +0 -16
- data/gemfiles/avro_1.8.2.gemfile +0 -7
- data/gemfiles/avro_1.9.0.gemfile +0 -7
- data/gemfiles/avro_patches_0.x.gemfile +0 -8
- data/gemfiles/avro_patches_1.x.gemfile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dec624f01d72838e79c5d671db5e8e5df329fecc72bb2cb4b782a5f50f591936
|
4
|
+
data.tar.gz: 02d143c8181c2e196b3d488a086104c528d45b843be9319d4a1766716056b63a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c5c781421196c20ec4232ec0341d0c10420a5dbb6e7a9b9ddf4864f7372419763f9a7d36671fb323e94a077dc1fdffb76df6347bfe71d961fff2255951abbb
|
7
|
+
data.tar.gz: 0dc6f9d230c3719e268fa433798f440402d169f63eb8b522a73641e94769792c6a66c0cd9dda145cc5cc2faa4ae44b66723690afd8995d7b4eb43ae8adfb125c
|
@@ -0,0 +1,77 @@
|
|
1
|
+
version: 2.1
|
2
|
+
jobs:
|
3
|
+
lint:
|
4
|
+
docker:
|
5
|
+
- image: salsify/ruby_ci:2.6.6
|
6
|
+
working_directory: ~/avro-builder
|
7
|
+
steps:
|
8
|
+
- checkout
|
9
|
+
- restore_cache:
|
10
|
+
keys:
|
11
|
+
- v2-gems-ruby-2.6.6-{{ checksum "avro-builder.gemspec" }}-{{ checksum "Gemfile" }}
|
12
|
+
- v2-gems-ruby-2.6.6-
|
13
|
+
- run:
|
14
|
+
name: Install Gems
|
15
|
+
command: |
|
16
|
+
if ! bundle check --path=vendor/bundle; then
|
17
|
+
bundle install --path=vendor/bundle --jobs=4 --retry=3
|
18
|
+
bundle clean
|
19
|
+
fi
|
20
|
+
- save_cache:
|
21
|
+
key: v2-gems-ruby-2.6.6-{{ checksum "avro-builder.gemspec" }}-{{ checksum "Gemfile" }}
|
22
|
+
paths:
|
23
|
+
- "vendor/bundle"
|
24
|
+
- "gemfiles/vendor/bundle"
|
25
|
+
- run:
|
26
|
+
name: Run Rubocop
|
27
|
+
command: bundle exec rubocop
|
28
|
+
test:
|
29
|
+
parameters:
|
30
|
+
gemfile:
|
31
|
+
type: string
|
32
|
+
ruby-version:
|
33
|
+
type: string
|
34
|
+
docker:
|
35
|
+
- image: salsify/ruby_ci:<< parameters.ruby-version >>
|
36
|
+
environment:
|
37
|
+
CIRCLE_TEST_REPORTS: "test-results"
|
38
|
+
BUNDLE_GEMFILE: << parameters.gemfile >>
|
39
|
+
working_directory: ~/avro-builder
|
40
|
+
steps:
|
41
|
+
- checkout
|
42
|
+
- restore_cache:
|
43
|
+
keys:
|
44
|
+
- v2-gems-ruby-<< parameters.ruby-version >>-{{ checksum "avro-builder.gemspec" }}-{{ checksum "<< parameters.gemfile >>" }}
|
45
|
+
- v2-gems-ruby-<< parameters.ruby-version >>-
|
46
|
+
- run:
|
47
|
+
name: Install Gems
|
48
|
+
command: |
|
49
|
+
if ! bundle check --path=vendor/bundle; then
|
50
|
+
bundle install --path=vendor/bundle --jobs=4 --retry=3
|
51
|
+
bundle clean
|
52
|
+
fi
|
53
|
+
- save_cache:
|
54
|
+
key: v2-gems-ruby-<< parameters.ruby-version >>-{{ checksum "avro-builder.gemspec" }}-{{ checksum "<< parameters.gemfile >>" }}
|
55
|
+
paths:
|
56
|
+
- "vendor/bundle"
|
57
|
+
- "gemfiles/vendor/bundle"
|
58
|
+
- run:
|
59
|
+
name: Run Tests
|
60
|
+
command: |
|
61
|
+
bundle exec rspec --format RspecJunitFormatter --out $CIRCLE_TEST_REPORTS/rspec/junit.xml --format progress spec
|
62
|
+
- store_test_results:
|
63
|
+
path: "test-results"
|
64
|
+
workflows:
|
65
|
+
build:
|
66
|
+
jobs:
|
67
|
+
- lint
|
68
|
+
- test:
|
69
|
+
matrix:
|
70
|
+
parameters:
|
71
|
+
gemfile:
|
72
|
+
- "gemfiles/avro_1.9.gemfile"
|
73
|
+
- "gemfiles/avro_1.10.gemfile"
|
74
|
+
ruby-version:
|
75
|
+
- "2.6.6"
|
76
|
+
- "2.7.2"
|
77
|
+
- "3.0.0"
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.6
|
data/Appraisals
CHANGED
@@ -1,26 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
appraise 'avro-1.
|
4
|
-
gem 'avro', '1.
|
3
|
+
appraise 'avro-1.9' do
|
4
|
+
gem 'avro', '1.9.2'
|
5
5
|
end
|
6
6
|
|
7
|
-
appraise 'avro-1.
|
8
|
-
gem 'avro', '1.
|
9
|
-
end
|
10
|
-
|
11
|
-
appraise 'avro-1.9.1' do
|
12
|
-
gem 'avro', '1.9.1'
|
13
|
-
end
|
14
|
-
|
15
|
-
appraise 'avro-1.10.0' do
|
16
|
-
gem 'avro', '1.10.0'
|
17
|
-
end
|
18
|
-
|
19
|
-
appraise 'avro-patches-0.x' do
|
20
|
-
gem 'avro', '1.8.2'
|
21
|
-
gem 'avro-patches', '< 1.0.0'
|
22
|
-
end
|
23
|
-
|
24
|
-
appraise 'avro-patches-1.x' do
|
25
|
-
gem 'avro-patches', '>= 1.0.0'
|
7
|
+
appraise 'avro-1.10' do
|
8
|
+
gem 'avro', '1.10.1'
|
26
9
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# avro-builder changelog
|
2
2
|
|
3
|
+
## v1.0.0
|
4
|
+
- Drop support for Avro < 1.9.
|
5
|
+
- Drop support for Ruby < 2.6.
|
6
|
+
- Add Ruby 3.0 support.
|
7
|
+
- Bug fix: Use multi_json to encode schemas and ensure that a JSON encoder
|
8
|
+
is always present.
|
9
|
+
|
3
10
|
## v0.17.0
|
4
11
|
- Add support for enum defaults introduced in Avro v1.10.0.
|
5
12
|
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Avro::Builder
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://circleci.com/gh/salsify/avro-builder.svg?style=svg)][circleci]
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/avro-builder.svg)](https://badge.fury.io/rb/avro-builder)
|
5
5
|
|
6
|
-
[
|
6
|
+
[circleci]: https://circleci.com/gh/salsify/avro-builder
|
7
7
|
|
8
8
|
`Avro::Builder` provides a Ruby DSL to create [Apache Avro](https://avro.apache.org/docs/current/) Schemas.
|
9
9
|
|
@@ -283,18 +283,6 @@ The DSL supports setting a logical type on any type except a union. The logical
|
|
283
283
|
types defined in the Avro [spec](https://avro.apache.org/docs/1.8.1/spec.html#Logical+Types)
|
284
284
|
are more limited.
|
285
285
|
|
286
|
-
The official Ruby `avro` gem does not yet support logical types:
|
287
|
-
[AVRO-1695](https://issues.apache.org/jira/browse/AVRO-1695).
|
288
|
-
|
289
|
-
There is a [avro-patches](https://github.com/salsify/avro-patches) gem that patches
|
290
|
-
the official Avro Ruby gem to support
|
291
|
-
encoding and decoding logical types. To use this gem, reference it in your Gemfile
|
292
|
-
instead of the official Avro gem:
|
293
|
-
|
294
|
-
```ruby
|
295
|
-
gem 'avro-patches'
|
296
|
-
```
|
297
|
-
|
298
286
|
A logical type can be specified for a field using the `logical_type` attribute:
|
299
287
|
|
300
288
|
```ruby
|
data/avro-builder.gemspec
CHANGED
@@ -20,7 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.
|
23
|
+
spec.required_ruby_version = '>= 2.6'
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'avro', '>= 1.9.0', '< 1.11'
|
26
|
+
spec.add_runtime_dependency 'multi_json'
|
24
27
|
|
25
28
|
spec.add_development_dependency 'appraisal'
|
26
29
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
@@ -29,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
29
32
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
33
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
34
|
spec.add_development_dependency 'rspec-its'
|
32
|
-
spec.add_development_dependency '
|
35
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
36
|
+
spec.add_development_dependency 'salsify_rubocop', '~> 1.0.1'
|
33
37
|
spec.add_development_dependency 'simplecov'
|
34
38
|
end
|
data/lib/avro/builder/dsl.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avro'
|
4
|
+
require 'multi_json'
|
4
5
|
require 'avro/builder/errors'
|
5
6
|
require 'avro/builder/dsl_options'
|
6
7
|
require 'avro/builder/dsl_attributes'
|
@@ -77,7 +78,7 @@ module Avro
|
|
77
78
|
# Return the last schema object processed as an Avro JSON schema
|
78
79
|
def to_json(validate: true, pretty: true)
|
79
80
|
hash = to_h
|
80
|
-
|
81
|
+
MultiJson.dump(hash, { pretty: pretty }).tap do |json|
|
81
82
|
# Uncomment the next line to debug:
|
82
83
|
# puts json
|
83
84
|
# Parse the schema to validate before returning
|
@@ -13,7 +13,8 @@ module Avro
|
|
13
13
|
dsl_attribute :doc
|
14
14
|
dsl_attribute_alias :type_doc, :doc
|
15
15
|
|
16
|
-
def initialize(name = nil, options: {},
|
16
|
+
def initialize(name = nil, cache:, options: {}, field: nil, &block) # rubocop:disable Lint/MissingSuper
|
17
|
+
# TODO: Fix missing call to super
|
17
18
|
@avro_type_name = :record
|
18
19
|
@name = name
|
19
20
|
@cache = cache
|
data/lib/avro/builder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avro-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2021-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.9.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '1.11'
|
@@ -26,10 +26,24 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
29
|
+
version: 1.9.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '1.11'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: multi_json
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: appraisal
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,20 +142,34 @@ dependencies:
|
|
128
142
|
- - ">="
|
129
143
|
- !ruby/object:Gem::Version
|
130
144
|
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: rspec_junit_formatter
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
131
159
|
- !ruby/object:Gem::Dependency
|
132
160
|
name: salsify_rubocop
|
133
161
|
requirement: !ruby/object:Gem::Requirement
|
134
162
|
requirements:
|
135
163
|
- - "~>"
|
136
164
|
- !ruby/object:Gem::Version
|
137
|
-
version: 0.
|
165
|
+
version: 1.0.1
|
138
166
|
type: :development
|
139
167
|
prerelease: false
|
140
168
|
version_requirements: !ruby/object:Gem::Requirement
|
141
169
|
requirements:
|
142
170
|
- - "~>"
|
143
171
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0.
|
172
|
+
version: 1.0.1
|
145
173
|
- !ruby/object:Gem::Dependency
|
146
174
|
name: simplecov
|
147
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,12 +191,12 @@ executables: []
|
|
163
191
|
extensions: []
|
164
192
|
extra_rdoc_files: []
|
165
193
|
files:
|
194
|
+
- ".circleci/config.yml"
|
166
195
|
- ".gitignore"
|
167
196
|
- ".overcommit.yml"
|
168
197
|
- ".rspec"
|
169
198
|
- ".rubocop.yml"
|
170
199
|
- ".ruby-version"
|
171
|
-
- ".travis.yml"
|
172
200
|
- Appraisals
|
173
201
|
- CHANGELOG.md
|
174
202
|
- Gemfile
|
@@ -178,12 +206,8 @@ files:
|
|
178
206
|
- avro-builder.gemspec
|
179
207
|
- bin/console
|
180
208
|
- bin/setup
|
181
|
-
- gemfiles/avro_1.10.
|
182
|
-
- gemfiles/avro_1.
|
183
|
-
- gemfiles/avro_1.9.0.gemfile
|
184
|
-
- gemfiles/avro_1.9.1.gemfile
|
185
|
-
- gemfiles/avro_patches_0.x.gemfile
|
186
|
-
- gemfiles/avro_patches_1.x.gemfile
|
209
|
+
- gemfiles/avro_1.10.gemfile
|
210
|
+
- gemfiles/avro_1.9.gemfile
|
187
211
|
- lib/avro/builder.rb
|
188
212
|
- lib/avro/builder/aliasable.rb
|
189
213
|
- lib/avro/builder/anonymous_types.rb
|
@@ -230,15 +254,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
254
|
requirements:
|
231
255
|
- - ">="
|
232
256
|
- !ruby/object:Gem::Version
|
233
|
-
version: '
|
257
|
+
version: '2.6'
|
234
258
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
259
|
requirements:
|
236
260
|
- - ">="
|
237
261
|
- !ruby/object:Gem::Version
|
238
262
|
version: '0'
|
239
263
|
requirements: []
|
240
|
-
|
241
|
-
rubygems_version: 2.7.6.2
|
264
|
+
rubygems_version: 3.0.3
|
242
265
|
signing_key:
|
243
266
|
specification_version: 4
|
244
267
|
summary: Ruby DSL to create Avro schemas
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.5.8
|
4
|
-
- 2.6.6
|
5
|
-
- 2.7.1
|
6
|
-
before_install: gem install bundler -v 2.0.1 --no-document
|
7
|
-
before_script:
|
8
|
-
- bundle exec appraisal install --jobs=3
|
9
|
-
script:
|
10
|
-
- bundle exec rubocop
|
11
|
-
- bundle exec appraisal avro-1.8.2 rspec
|
12
|
-
- bundle exec appraisal avro-1.9.0 rspec
|
13
|
-
- bundle exec appraisal avro-1.9.1 rspec
|
14
|
-
- bundle exec appraisal avro-1.10.0 rspec
|
15
|
-
- bundle exec appraisal avro-patches-0.x rspec
|
16
|
-
- bundle exec appraisal avro-patches-1.x rspec
|
data/gemfiles/avro_1.8.2.gemfile
DELETED
data/gemfiles/avro_1.9.0.gemfile
DELETED