Open ttencate opened 3 years ago
I hacked around this in my fork, but my approach is probably not the best way so I doubt it's worth a PR: https://github.com/ttencate/avro-rs/commit/1c89f55134797e2ed7825f6434cd3f1efc1fe48b
Thanks for reporting the bug. As for the compilation, the error should disappear if you can update your rust version.
Using avro-rs 0.11.0 because 0.12.0 won't compile for me.
I think this happens because
UnionSchema::find_schema
only looks for a variant that matches the input type exactly:https://github.com/flavray/avro-rs/blob/de6153ecea6fe660bcf20ff67f47a0b05211b8e1/src/schema.rs#L343-L349
That logic fails here, because the schema contains a
Schema::Date
variant but the incoming value is aValue::Int
. Note thatValue::validate
handles this case correctly.