- Allow for date time to be a string if it can be parsed
- Avoid allocating default empty hash in
Avromatic::IO::DatumReader.read_data
- Add support for Rails 6.0.
- Drop support for Ruby < 2.4.
- Add
key_schema_name
andvalue_schema_name
attributes toUnexpectedKeyError
.
- Optimize model initialization and decoding
- Allow generated model attribute accessors to be overridden. This was a regression in Avromatic 2.0.0.
- Ensure that timestamp-millis are coerced when the number of microseconds is divisible by 1,000 but the number of nanoseconds is not divisible by 1,000,000.
- Remove virtus dependency resulting in a 3x performance improvement in model instantation and 1.4x - 2.0x performance improvement in Avro serialization and Avromatic code simplification.
- Raise
Avromatic::Model::CoercionError
when attribute values can't be coerced to the target type in model constructors and attribute setters. Previously coercion errors weren't detected until Avro serialization or an explicit call tovalid?
. - Prevent model instances from being constructed with unknown attributes. Previously unknown attributes were ignored.
This can be disabled by setting
Avromatic.allow_unknown_attributes
totrue
. WARNING: SettingAvromatic.allow_unknown_attributes
totrue
will result in incorrect union member coercions if an earlier union member is satisfied by a subset of the latter union member's attributes. - Validate required attributes are present when serializing to Avro for better error messages. Explicit
validation can still be done by calling the
valid?
orinvalid?
methods from the ActiveModel::Validations interface but errors will now appear under the:base
key. Previously these errors were detected late in the Avro serialization process resulting in hard to understand error messages. - Support for custom types in unions with more than one non-null type.
- Drop support for Ruby < 2.3 and Rails < 5.0.
- Call
super()
in model constructor making it easier to define class/module hierarchies for models.
- No changes.
- Fix compatibility with avro-patches v0.4.0.
- Improve partial assignment using a hash for records outside of unions.
- Prevent invalid types from being assigned to primitives in unions.
- Add validation that primitive attributes have the expected type.
- Add support for Rails 5.2.
- Add
Avromatic::Model::MessageDecoder#model
method to return the Avromatic model class for a message.
- Add
Avromatic.build_messaging!
toavromatic/rspec
.
- Add new public methods
#avro_key_datum
and#avro_value_datum
on an Avromatic model instance that return the attributes of the model suitable for Avro encoding without any customizations.
- Fix a bug that raised an error when encoding a cached model containing optional
field(s). With this change, immutable model caching now enabled only when
avro-patches
is present.
- Add support for caching avro encodings for immutable models
- Patches avromatic model classes to cache
Virtus::ValueObject::AllowedWriterMethods#allowed_writer_methods
- Support Rails 5.1
- Caches result of Avromatic::Model::RawSerialization#value_attributes_for_avro for immutable models
- Disallow optional fields in schemas used for keys by default.
- Add
Avromatic::IO::DatumWriter
to optimize the encoding of Avro unions from Avromatic models. - Expose the
#key_attributes_for_avro
method on models.
- Add mutable option when defining a model.
- Require
avro_schema_registry_client
v0.3.0 or later to avoid usingavro-salsify-fork
.
- Fix a bug in the optimization of optional union decoding.
- Remove monkey-patches for
AvroTurf::ConfluentSchemaRegistry
andFakeConfluentSchemaRegistryServer
and depend onavro_schema_registry-client
instead. - Rename the configuration option
use_cacheable_schema_registration
touse_schema_fingerprint_lookup
.
- Support schema stores with a
#clear_schemas
method.
- Use a fingerprint based on
avro-resolution_canonical_form
.
- Replace another reference to
avromatic/test/fake_schema_registry_server
.
- Compatibility with
avro_turf
v0.8.0.avromatic/test/fake_schema_registry_server
is now deprecated and will be removed in a future release. Useavromatic/test/fake_confluent_schema_registry_server
instead.
- Correctly namespace Avro errors raised by
Avromatic::IO::DatumReader
.
- Add
.register_schemas!
method to generated models to register the associated schemas in a schema registry.
- Add
#lookup_subject_schema
method toAvroTurf::SchemaRegistry
patch to directly support looking up existing schema ids by fingerprint.
- Add
Avromatic.use_cacheable_schema_registration
option to control the lookup of existing schema ids by fingerprint.
- Add patch to
AvroTurf::SchemaRegistry
to lookup existing schema ids usingGET /subjects/:subject/fingerprints/:fingerprint
from#register
. This endpoint is supported in the avro-schema-registry. - Add patch to the
FakeSchemaRegistryServer
fromAvroTurf
to support the fingerprint endpoint.
- Add
Avromatic::Messaging
andAvromatic::IO::DatumReader
classes to optimize the decoding of Avro unions to Avromatic models.
- Add interfaces to deserialize as a hash of attributes instead of a model.
- Clear the schema store, if it supports it, prior to code reloading in Rails applications. This allows schema changes to be picked up during code reloading.
- Fix for models containing optional array and map fields.
- Another fix for Rails initialization and reloading. Do not clear the nested
models registry the first time that the
to_prepare
hook is called.
- Replace
Avromatic.on_initialize
proc withAvromatic.eager_load_models
array. The models listed by this configuration are added to the registry at the end of.configure
and prior to code reloading in Rails applications. This is a compatibility breaking change.
- Add
Avromatic.on_initialize
proc that is called at the end of.configure
and on code reloading in Rails applications.
- Experimental: Add support for more than one non-null type in a union.
- Allow nested models to be referenced and reused.
- Fix the serialization of nested complex types.
- Add support for recursive models.
- Allow required array and map fields to be empty. Only nil values for required array and map fields are now considered invalid.
- Validate nested models. This includes models embedded within other complex types (array, map, and union).
- Truncate values for timestamps to the precision supported by the logical type.
- Add support for logical types. Currently this requires using the
avro-salsify-fork
gem for logical types support with Ruby.
- Raise a more descriptive error when attempting to generate a model for a non-record Avro type.
- Add RSpec
FakeSchemaRegistryServer
test helper.
- Remove dependency on
Hash#transform_values
fromActiveSupport
v4.2.
- Fix serialization of array and map types that contain nested models.
- Require
avro_turf
v0.7.0 or later.
- Rename
Avromatic::Model::Decoder
toMessageDecoder
. - Rename
.deserialize
on generated models to.avro_message_decode
. - Add
#avro_raw_key
,#avro_raw_value
and.avro_raw_decode
methods to generated models to support encoding and decoding without a schema registry.
- Allow the specification of a custom type, including conversion to/from Avro, for named types.
- Remove dependency on the
private_attr
gem.
- Allow a module level schema registry to be configured.
- Do not build an
AvroTurf::Messaging
object for each model class.
- Fix Railtie.
- Initial release