lib/avro/builder/field.rb in avro-builder-0.1.0 vs lib/avro/builder/field.rb in avro-builder-0.2.0
- old
+ new
@@ -66,13 +66,13 @@
}.reject { |_, v| v.nil? }
end
private
- # Optional types must be serialized as an array.
+ # Optional types must be serialized as a union -- an array of types.
def serialized_type(reference_state)
result = type.serialize(reference_state)
- optional ? [:null, result] : result
+ optional ? type.class.union_with_null(result) : result
end
end
end
end