avromatic 2.2.4 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +89 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +4 -1
- data/Appraisals +8 -14
- data/CHANGELOG.md +23 -0
- data/README.md +3 -20
- data/avromatic.gemspec +9 -8
- data/bin/console +4 -3
- data/gemfiles/avro1_10_rails6_1.gemfile +9 -0
- data/gemfiles/{avro1_8_rails5_2.gemfile → avro1_9_rails6_1.gemfile} +3 -3
- data/lib/avromatic.rb +0 -5
- data/lib/avromatic/io.rb +1 -7
- data/lib/avromatic/io/datum_reader.rb +18 -68
- data/lib/avromatic/io/datum_writer.rb +5 -11
- data/lib/avromatic/io/union_datum.rb +25 -0
- data/lib/avromatic/messaging.rb +4 -2
- data/lib/avromatic/model/attributes.rb +28 -9
- data/lib/avromatic/model/configurable.rb +30 -2
- data/lib/avromatic/model/configuration.rb +5 -0
- data/lib/avromatic/model/field_helper.rb +5 -1
- data/lib/avromatic/model/messaging_serialization.rb +2 -1
- data/lib/avromatic/model/raw_serialization.rb +67 -24
- data/lib/avromatic/model/types/abstract_timestamp_type.rb +1 -1
- data/lib/avromatic/model/types/abstract_type.rb +3 -1
- data/lib/avromatic/model/types/array_type.rb +2 -2
- data/lib/avromatic/model/types/boolean_type.rb +1 -1
- data/lib/avromatic/model/types/custom_type.rb +1 -1
- data/lib/avromatic/model/types/date_type.rb +1 -1
- data/lib/avromatic/model/types/enum_type.rb +1 -1
- data/lib/avromatic/model/types/fixed_type.rb +1 -1
- data/lib/avromatic/model/types/float_type.rb +1 -1
- data/lib/avromatic/model/types/integer_type.rb +1 -1
- data/lib/avromatic/model/types/map_type.rb +2 -2
- data/lib/avromatic/model/types/null_type.rb +1 -1
- data/lib/avromatic/model/types/record_type.rb +4 -7
- data/lib/avromatic/model/types/string_type.rb +1 -1
- data/lib/avromatic/model/types/union_type.rb +12 -9
- data/lib/avromatic/model/validation.rb +2 -2
- data/lib/avromatic/version.rb +1 -1
- metadata +45 -34
- data/.travis.yml +0 -16
- data/gemfiles/avro_patches_rails5_2.gemfile +0 -9
- data/gemfiles/avro_patches_rails6_0.gemfile +0 -9
- data/lib/avromatic/patches.rb +0 -18
- data/lib/avromatic/patches/schema_validator_patch.rb +0 -39
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_script:
|
7
|
-
- bundle exec rubocop
|
8
|
-
gemfile:
|
9
|
-
- gemfiles/avro1_8_rails5_2.gemfile
|
10
|
-
- gemfiles/avro1_9_rails5_2.gemfile
|
11
|
-
- gemfiles/avro1_10_rails5_2.gemfile
|
12
|
-
- gemfiles/avro1_9_rails6_0.gemfile
|
13
|
-
- gemfiles/avro1_10_rails6_0.gemfile
|
14
|
-
- gemfiles/avro_patches_rails5_2.gemfile
|
15
|
-
- gemfiles/avro_patches_rails6_0.gemfile
|
16
|
-
script: bundle exec rspec
|
data/lib/avromatic/patches.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
loaded_avro_patches = begin
|
4
|
-
require 'avro-patches'
|
5
|
-
true
|
6
|
-
rescue LoadError
|
7
|
-
false
|
8
|
-
end
|
9
|
-
|
10
|
-
if loaded_avro_patches
|
11
|
-
require 'avromatic/patches/schema_validator_patch'
|
12
|
-
avro_patches_version = Gem::Version.new(AvroPatches::VERSION)
|
13
|
-
if avro_patches_version < Gem::Version.new('0.4.0')
|
14
|
-
Avro::SchemaValidator.singleton_class.prepend(Avromatic::Patches::SchemaValidatorPatch)
|
15
|
-
else
|
16
|
-
Avro::SchemaValidator.singleton_class.prepend(Avromatic::Patches::SchemaValidatorPatchV040)
|
17
|
-
end
|
18
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avromatic
|
4
|
-
module Patches
|
5
|
-
module SchemaValidatorPatch
|
6
|
-
# This method replaces validate_recursive in AvroPatches::LogicalTypes::SchemaValidatorPatch
|
7
|
-
# to enable validating datums that contain an encoding provider.
|
8
|
-
def validate_recursive(expected_schema, logical_datum, path, result, encoded = false)
|
9
|
-
datum = resolve_datum(expected_schema, logical_datum, encoded)
|
10
|
-
case expected_schema.type_sym
|
11
|
-
when :record, :error, :request
|
12
|
-
if datum.is_a?(Hash) && datum.key?(Avromatic::IO::ENCODING_PROVIDER)
|
13
|
-
return if expected_schema.sha256_resolution_fingerprint ==
|
14
|
-
datum[Avromatic::IO::ENCODING_PROVIDER].value_avro_schema.sha256_resolution_fingerprint
|
15
|
-
raise Avro::SchemaValidator::ValidationError
|
16
|
-
end
|
17
|
-
end
|
18
|
-
super(expected_schema, logical_datum, path, result, encoded)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module SchemaValidatorPatchV040
|
23
|
-
# This method replaces validate_recursive in AvroPatches::LogicalTypes::SchemaValidatorPatch
|
24
|
-
# to enable validating datums that contain an encoding provider.
|
25
|
-
def validate_recursive(expected_schema, logical_datum, path, result, options = {})
|
26
|
-
datum = resolve_datum(expected_schema, logical_datum, options[:encoded])
|
27
|
-
case expected_schema.type_sym
|
28
|
-
when :record, :error, :request
|
29
|
-
if datum.is_a?(Hash) && datum.key?(Avromatic::IO::ENCODING_PROVIDER)
|
30
|
-
return if expected_schema.sha256_resolution_fingerprint ==
|
31
|
-
datum[Avromatic::IO::ENCODING_PROVIDER].value_avro_schema.sha256_resolution_fingerprint
|
32
|
-
raise Avro::SchemaValidator::ValidationError
|
33
|
-
end
|
34
|
-
end
|
35
|
-
super(expected_schema, logical_datum, path, result, options)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|