Description
When calling to_avro on an Avro::Schema::Field instance (part of calling to_avro on an instance of Avro::Schema::RecordSchema), it will not include the default value definition if the default value is falsey.
The offending code is:
def to_avro(names=Set.new) {'name' => name, 'type' => type.to_avro(names)}.tap do |avro| avro['default'] = default if default avro['order'] = order if order end end
Using the if default conditional predicate here is inappropriate, as is relying on nil values to represent no default, because null in JSON maps to nil in Ruby.
This is a critical show-stopper to using AvroTurf with the Confluent Schema Registry because it is quietly uploading incorrect schemas, causing downstream readers to behave incorrectly and also causing the schema registry to reject new schema versions as incompatible when they are actually just fine if the falsey default values are included when submitting the schema to the registry.
Attachments
Issue Links
- blocks
-
AVRO-1885 Release 1.8.2
- Resolved
- links to