avromatic 2.2.3 → 2.4.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 +85 -0
- data/.rubocop.yml +3 -0
- data/.ruby-version +1 -1
- data/Appraisals +34 -22
- data/CHANGELOG.md +19 -0
- data/README.md +3 -3
- data/avromatic.gemspec +7 -6
- data/bin/console +4 -3
- data/gemfiles/{rails5_0.gemfile → avro1_10_rails5_2.gemfile} +3 -3
- data/gemfiles/avro1_10_rails6_0.gemfile +9 -0
- data/gemfiles/avro1_10_rails6_1.gemfile +9 -0
- data/gemfiles/{rails5_2.gemfile → avro1_8_rails5_2.gemfile} +0 -0
- data/gemfiles/{rails5_1.gemfile → avro1_9_rails5_2.gemfile} +3 -3
- data/gemfiles/{rails6_0.gemfile → avro1_9_rails6_0.gemfile} +1 -1
- data/gemfiles/{avro_patches_rails5_0.gemfile → avro1_9_rails6_1.gemfile} +3 -3
- data/gemfiles/avro_patches_rails5_2.gemfile +1 -1
- data/gemfiles/avro_patches_rails6_1.gemfile +9 -0
- 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 +11 -8
- data/lib/avromatic/model/validation.rb +2 -2
- data/lib/avromatic/version.rb +1 -1
- metadata +62 -47
- data/.travis.yml +0 -23
- data/gemfiles/avro_patches_rails5_1.gemfile +0 -9
- data/lib/avromatic/patches.rb +0 -18
- data/lib/avromatic/patches/schema_validator_patch.rb +0 -39
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
|