martin-g commented on PR #1921:
URL: https://github.com/apache/avro/pull/1921#issuecomment-1311661938
> The avro_derive tests fail ...
The problem here is that another user (@jklamer, the contributor of the
avro_derive crate) expects that
```rust
#[derive(Debug, Deserialize, Serialize, AvroSchema, Clone, PartialEq, Eq)]
enum MyEnum {
Foo,
Bar,
Baz,
}
```
should map to this Avro schema:
```
{
"name":"myenum",
"type":{
"type":"enum",
"name":"MyEnum",
"symbols":["Foo", "Bar", "Baz"]
},
"default":"Foo"
}
```
which is really nice! but unfortunately does not work anymore with the new
way of supporting complex Rust enums (ones with non-null tuple/newtype/struct
variants).
The only way to still support the above I see is to introduce a second
`Serializer` impl, e.g. UnitEnumSerializer and let the user decide which one to
use. But the problem is that a `Writer` could use either the complex Serializer
or the UnitEnumSerializer. There won't be a way to use one serializer for a
given RecordField and another serializer for another field.
Also CC @spiegela
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]