lib/avromatic/model/raw_serialization.rb in avromatic-2.2.4 vs lib/avromatic/model/raw_serialization.rb in avromatic-2.2.5

- old
+ new

@@ -53,11 +53,14 @@ private def avro_hash(fields, strict: false, validate:) avro_validate! if validate - attributes.slice(*fields).each_with_object(Hash.new) do |(key, value), result| - result[key.to_s] = attribute_definitions[key].serialize(value, strict: strict) + fields.each_with_object(Hash.new) do |field, result| + next unless _attributes.include?(field) + + value = _attributes[field] + result[field.to_s] = attribute_definitions[field].serialize(value, strict) end end def avro_raw_encode(data, key_or_value = :value) stream = StringIO.new