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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +89 -0
  3. data/.gitignore +3 -0
  4. data/.rubocop.yml +4 -1
  5. data/Appraisals +8 -14
  6. data/CHANGELOG.md +23 -0
  7. data/README.md +3 -20
  8. data/avromatic.gemspec +9 -8
  9. data/bin/console +4 -3
  10. data/gemfiles/avro1_10_rails6_1.gemfile +9 -0
  11. data/gemfiles/{avro1_8_rails5_2.gemfile → avro1_9_rails6_1.gemfile} +3 -3
  12. data/lib/avromatic.rb +0 -5
  13. data/lib/avromatic/io.rb +1 -7
  14. data/lib/avromatic/io/datum_reader.rb +18 -68
  15. data/lib/avromatic/io/datum_writer.rb +5 -11
  16. data/lib/avromatic/io/union_datum.rb +25 -0
  17. data/lib/avromatic/messaging.rb +4 -2
  18. data/lib/avromatic/model/attributes.rb +28 -9
  19. data/lib/avromatic/model/configurable.rb +30 -2
  20. data/lib/avromatic/model/configuration.rb +5 -0
  21. data/lib/avromatic/model/field_helper.rb +5 -1
  22. data/lib/avromatic/model/messaging_serialization.rb +2 -1
  23. data/lib/avromatic/model/raw_serialization.rb +67 -24
  24. data/lib/avromatic/model/types/abstract_timestamp_type.rb +1 -1
  25. data/lib/avromatic/model/types/abstract_type.rb +3 -1
  26. data/lib/avromatic/model/types/array_type.rb +2 -2
  27. data/lib/avromatic/model/types/boolean_type.rb +1 -1
  28. data/lib/avromatic/model/types/custom_type.rb +1 -1
  29. data/lib/avromatic/model/types/date_type.rb +1 -1
  30. data/lib/avromatic/model/types/enum_type.rb +1 -1
  31. data/lib/avromatic/model/types/fixed_type.rb +1 -1
  32. data/lib/avromatic/model/types/float_type.rb +1 -1
  33. data/lib/avromatic/model/types/integer_type.rb +1 -1
  34. data/lib/avromatic/model/types/map_type.rb +2 -2
  35. data/lib/avromatic/model/types/null_type.rb +1 -1
  36. data/lib/avromatic/model/types/record_type.rb +4 -7
  37. data/lib/avromatic/model/types/string_type.rb +1 -1
  38. data/lib/avromatic/model/types/union_type.rb +12 -9
  39. data/lib/avromatic/model/validation.rb +2 -2
  40. data/lib/avromatic/version.rb +1 -1
  41. metadata +45 -34
  42. data/.travis.yml +0 -16
  43. data/gemfiles/avro_patches_rails5_2.gemfile +0 -9
  44. data/gemfiles/avro_patches_rails6_0.gemfile +0 -9
  45. data/lib/avromatic/patches.rb +0 -18
  46. 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
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "avro-patches", ">= 0.4.1", "< 1.0"
6
- gem "activesupport", "~> 5.2.0"
7
- gem "activemodel", "~> 5.2.0"
8
-
9
- gemspec path: "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "avro-patches", ">= 1.0.0"
6
- gem "activesupport", "~> 6.0.0"
7
- gem "activemodel", "~> 6.0.0"
8
-
9
- gemspec path: "../"
@@ -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