avro-builder 0.16.1 → 0.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +8 -0
- data/.ruby-version +1 -1
- data/.travis.yml +6 -3
- data/Appraisals +10 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/avro-builder.gemspec +7 -7
- data/gemfiles/avro_1.10.0.gemfile +7 -0
- data/gemfiles/avro_1.9.1.gemfile +7 -0
- data/lib/avro/builder.rb +2 -0
- data/lib/avro/builder/aliasable.rb +2 -0
- data/lib/avro/builder/anonymous_types.rb +2 -0
- data/lib/avro/builder/definition_cache.rb +4 -3
- data/lib/avro/builder/dsl.rb +3 -0
- data/lib/avro/builder/dsl_attributes.rb +2 -0
- data/lib/avro/builder/dsl_options.rb +2 -0
- data/lib/avro/builder/enum.rb +2 -0
- data/lib/avro/builder/errors.rb +2 -0
- data/lib/avro/builder/field.rb +3 -1
- data/lib/avro/builder/file_handler.rb +2 -0
- data/lib/avro/builder/fixed.rb +2 -0
- data/lib/avro/builder/namespaceable.rb +2 -0
- data/lib/avro/builder/railtie.rb +3 -1
- data/lib/avro/builder/rake/avro_generate_task.rb +3 -0
- data/lib/avro/builder/rake/rails_avro_generate_task.rake +3 -1
- data/lib/avro/builder/record.rb +2 -0
- data/lib/avro/builder/schema_serializer_reference_state.rb +2 -0
- data/lib/avro/builder/schema_store.rb +2 -0
- data/lib/avro/builder/type_factory.rb +4 -2
- data/lib/avro/builder/types.rb +2 -0
- data/lib/avro/builder/types/array_type.rb +2 -0
- data/lib/avro/builder/types/complex_type.rb +2 -0
- data/lib/avro/builder/types/enum_type.rb +2 -0
- data/lib/avro/builder/types/fixed_type.rb +2 -0
- data/lib/avro/builder/types/map_type.rb +2 -0
- data/lib/avro/builder/types/named_error_handling.rb +2 -0
- data/lib/avro/builder/types/named_type.rb +2 -0
- data/lib/avro/builder/types/record_type.rb +3 -1
- data/lib/avro/builder/types/top_level.rb +2 -0
- data/lib/avro/builder/types/type.rb +3 -3
- data/lib/avro/builder/types/type_referencer.rb +2 -0
- data/lib/avro/builder/types/union_type.rb +3 -1
- data/lib/avro/builder/version.rb +3 -1
- metadata +37 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 200291b14e045c942db013af4e3288ff6f6fd58bd72dec71d07dcd5b3dd8feaa
|
4
|
+
data.tar.gz: 41ec29b767c1133feb64c91766681b58dd98696e27ee4be504a27a6201ee4950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: affd413784160d10c371d1d70547d58332d388726d31a727b242c85823a068e5d9e97d12a999ee96bcdd6db2796cbd6ea2f70566ccdd707bd3e21995373aac3c
|
7
|
+
data.tar.gz: d94ffa43cd149edf03046b17368d56d2b3229cc46ad92e3f1dd7588f056078ec4e6679f3157968989e319db7d25f10d461f25cca3e651d8fcb07b66d0531a004
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.5.8
|
data/.travis.yml
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
3
|
+
- 2.5.8
|
4
|
+
- 2.6.6
|
5
|
+
- 2.7.1
|
6
|
+
before_install: gem install bundler -v 2.0.1 --no-document
|
6
7
|
before_script:
|
7
8
|
- bundle exec appraisal install --jobs=3
|
8
9
|
script:
|
9
10
|
- bundle exec rubocop
|
10
11
|
- bundle exec appraisal avro-1.8.2 rspec
|
11
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
|
12
15
|
- bundle exec appraisal avro-patches-0.x rspec
|
13
16
|
- bundle exec appraisal avro-patches-1.x rspec
|
data/Appraisals
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
appraise 'avro-1.8.2' do
|
2
4
|
gem 'avro', '1.8.2'
|
3
5
|
end
|
@@ -6,6 +8,14 @@ appraise 'avro-1.9.0' do
|
|
6
8
|
gem 'avro', '1.9.0'
|
7
9
|
end
|
8
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
|
+
|
9
19
|
appraise 'avro-patches-0.x' do
|
10
20
|
gem 'avro', '1.8.2'
|
11
21
|
gem 'avro-patches', '< 1.0.0'
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/avro-builder.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'avro/builder/version'
|
6
6
|
|
@@ -20,15 +20,15 @@ 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.add_runtime_dependency 'avro', '>= 1.7.0', '< 1.
|
23
|
+
spec.add_runtime_dependency 'avro', '>= 1.7.0', '< 1.11'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'appraisal'
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
27
|
+
spec.add_development_dependency 'json_spec'
|
28
|
+
spec.add_development_dependency 'overcommit'
|
27
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
31
|
spec.add_development_dependency 'rspec-its'
|
30
|
-
spec.add_development_dependency '
|
32
|
+
spec.add_development_dependency 'salsify_rubocop', '~> 0.85.0'
|
31
33
|
spec.add_development_dependency 'simplecov'
|
32
|
-
spec.add_development_dependency 'salsify_rubocop', '~> 0.48.0'
|
33
|
-
spec.add_development_dependency 'overcommit'
|
34
34
|
end
|
data/lib/avro/builder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Avro
|
2
4
|
module Builder
|
3
5
|
|
@@ -22,9 +24,7 @@ module Avro
|
|
22
24
|
key_str = Avro::Name.make_fullname(key.to_s, namespace && namespace.to_s)
|
23
25
|
object = schema_objects[key_str]
|
24
26
|
|
25
|
-
if object.nil? && !schema_names.include?(key.to_s)
|
26
|
-
object = builder.import(key)
|
27
|
-
end
|
27
|
+
object = builder.import(key) if object.nil? && !schema_names.include?(key.to_s)
|
28
28
|
|
29
29
|
raise DefinitionNotFoundError.new(key) if object.nil? && namespace.nil?
|
30
30
|
|
@@ -59,6 +59,7 @@ module Avro
|
|
59
59
|
|
60
60
|
def store_by_fullname(object, fullname = object.fullname)
|
61
61
|
raise DuplicateDefinitionError.new(fullname, object, schema_objects[fullname]) if schema_objects.key?(fullname)
|
62
|
+
|
62
63
|
schema_objects.store(fullname, object)
|
63
64
|
end
|
64
65
|
|
data/lib/avro/builder/dsl.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'avro'
|
2
4
|
require 'avro/builder/errors'
|
3
5
|
require 'avro/builder/dsl_options'
|
@@ -96,6 +98,7 @@ module Avro
|
|
96
98
|
def type_macro(name, type_object, options = {})
|
97
99
|
raise "#{type_object.inspect} must be a type object" unless type_object.is_a?(Types::Type)
|
98
100
|
raise "namespace cannot be included in name: #{name}" if name.to_s.index('.')
|
101
|
+
|
99
102
|
type_clone = type_object.clone
|
100
103
|
type_clone.send(:abstract=, true)
|
101
104
|
cache.add_type_by_name(type_clone, name, options[:namespace] || namespace)
|
data/lib/avro/builder/enum.rb
CHANGED
data/lib/avro/builder/errors.rb
CHANGED
data/lib/avro/builder/field.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'avro/builder/type_factory'
|
2
4
|
require 'avro/builder/aliasable'
|
3
5
|
|
@@ -12,7 +14,7 @@ module Avro
|
|
12
14
|
include Avro::Builder::Aliasable
|
13
15
|
include Avro::Builder::AnonymousTypes
|
14
16
|
|
15
|
-
INTERNAL_ATTRIBUTES =
|
17
|
+
INTERNAL_ATTRIBUTES = [:optional_field].to_set.freeze
|
16
18
|
|
17
19
|
# These attributes may be set as options or via a block in the DSL
|
18
20
|
dsl_attributes :doc, :default, :order
|
data/lib/avro/builder/fixed.rb
CHANGED
data/lib/avro/builder/railtie.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Avro
|
2
4
|
module Builder
|
3
5
|
class Railtie < Rails::Railtie
|
@@ -7,7 +9,7 @@ module Avro
|
|
7
9
|
end
|
8
10
|
|
9
11
|
rake_tasks do
|
10
|
-
load File.expand_path('
|
12
|
+
load File.expand_path('rake/rails_avro_generate_task.rake', __dir__)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake/tasklib'
|
2
4
|
require 'avro/builder'
|
3
5
|
|
@@ -31,6 +33,7 @@ module Avro
|
|
31
33
|
desc task_desc
|
32
34
|
task(name.to_sym => dependencies) do
|
33
35
|
raise '"root" must be specified for Avro DSL files' unless root
|
36
|
+
|
34
37
|
Avro::Builder.add_load_path(*[root, load_paths].flatten)
|
35
38
|
Dir["#{root}/**/*.rb"].each do |dsl_file|
|
36
39
|
puts "Generating Avro schema from #{dsl_file}"
|
data/lib/avro/builder/record.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Avro
|
2
4
|
module Builder
|
3
5
|
|
4
6
|
# This concern is used by classes that create new Type instances.
|
5
7
|
module TypeFactory
|
6
8
|
|
7
|
-
NAMED_TYPES =
|
8
|
-
COMPLEX_TYPES =
|
9
|
+
NAMED_TYPES = ['enum', 'fixed', 'record'].map(&:freeze).to_set.freeze
|
10
|
+
COMPLEX_TYPES = ['array', 'enum', 'fixed', 'map', 'record', 'union'].map(&:freeze).to_set.freeze
|
9
11
|
BUILTIN_TYPES = Avro::Schema::PRIMITIVE_TYPES.union(COMPLEX_TYPES).freeze
|
10
12
|
|
11
13
|
private
|
data/lib/avro/builder/types.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Avro
|
2
4
|
module Builder
|
3
5
|
module Types
|
@@ -6,7 +8,7 @@ module Avro
|
|
6
8
|
class RecordType < Avro::Builder::Types::NamedType
|
7
9
|
include Avro::Builder::AnonymousTypes
|
8
10
|
|
9
|
-
DSL_METHODS =
|
11
|
+
DSL_METHODS = [:required, :optional, :extends].to_set.freeze
|
10
12
|
|
11
13
|
dsl_attribute :doc
|
12
14
|
dsl_attribute_alias :type_doc, :doc
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Avro
|
2
4
|
module Builder
|
3
5
|
module Types
|
@@ -82,9 +84,7 @@ module Avro
|
|
82
84
|
|
83
85
|
def validate_required_attribute!(attribute_name)
|
84
86
|
value = public_send(attribute_name)
|
85
|
-
if value.nil? || value.respond_to?(:empty?) && value.empty?
|
86
|
-
required_attribute_error!(attribute_name)
|
87
|
-
end
|
87
|
+
required_attribute_error!(attribute_name) if value.nil? || value.respond_to?(:empty?) && value.empty?
|
88
88
|
end
|
89
89
|
|
90
90
|
attr_accessor :field, :cache
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Avro
|
2
4
|
module Builder
|
3
5
|
module Types
|
@@ -5,7 +7,7 @@ module Avro
|
|
5
7
|
include Avro::Builder::Types::ComplexType
|
6
8
|
include Avro::Builder::Types::TypeReferencer
|
7
9
|
|
8
|
-
NULL_TYPE = 'null'
|
10
|
+
NULL_TYPE = 'null'
|
9
11
|
|
10
12
|
dsl_attribute :types do |*types|
|
11
13
|
if !types.empty?
|
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.16.
|
4
|
+
version: 0.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify Engineering
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 1.7.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: '1.11'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 1.7.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
32
|
+
version: '1.11'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: appraisal
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,72 +50,72 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '2.0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '2.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: json_spec
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: overcommit
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - "
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- - "
|
86
|
+
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: rake
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
95
|
+
version: '10.0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
102
|
+
version: '10.0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
104
|
+
name: rspec
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
107
|
+
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
109
|
+
version: '3.0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- - "
|
114
|
+
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
116
|
+
version: '3.0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: rspec-its
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
@@ -134,16 +134,16 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: 0.
|
137
|
+
version: 0.85.0
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0.
|
144
|
+
version: 0.85.0
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
146
|
+
name: simplecov
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - ">="
|
@@ -178,8 +178,10 @@ files:
|
|
178
178
|
- avro-builder.gemspec
|
179
179
|
- bin/console
|
180
180
|
- bin/setup
|
181
|
+
- gemfiles/avro_1.10.0.gemfile
|
181
182
|
- gemfiles/avro_1.8.2.gemfile
|
182
183
|
- gemfiles/avro_1.9.0.gemfile
|
184
|
+
- gemfiles/avro_1.9.1.gemfile
|
183
185
|
- gemfiles/avro_patches_0.x.gemfile
|
184
186
|
- gemfiles/avro_patches_1.x.gemfile
|
185
187
|
- lib/avro/builder.rb
|
@@ -220,7 +222,7 @@ homepage: https://github.com/salsify/avro-builder.git
|
|
220
222
|
licenses:
|
221
223
|
- MIT
|
222
224
|
metadata: {}
|
223
|
-
post_install_message:
|
225
|
+
post_install_message:
|
224
226
|
rdoc_options: []
|
225
227
|
require_paths:
|
226
228
|
- lib
|
@@ -235,9 +237,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
237
|
- !ruby/object:Gem::Version
|
236
238
|
version: '0'
|
237
239
|
requirements: []
|
238
|
-
rubyforge_project:
|
239
|
-
rubygems_version: 2.6.
|
240
|
-
signing_key:
|
240
|
+
rubyforge_project:
|
241
|
+
rubygems_version: 2.7.6.2
|
242
|
+
signing_key:
|
241
243
|
specification_version: 4
|
242
244
|
summary: Ruby DSL to create Avro schemas
|
243
245
|
test_files: []
|