jklamer commented on PR #1921:
URL: https://github.com/apache/avro/pull/1921#issuecomment-1312075157

   Yeah, this conversation is split over a couple different PR's, threads, and 
e-mails. But I'll respond here. With `avro_derive` I was very intentional about 
only tackling cases that I could make work automatically with serde and the 
normal serializer for the best new user experience. Modeling a Rust enum as 
some Avro entity opened too many cans of worms to handle automatically, having 
something opt in would be the only way to go but would also make it harder to 
mix Rust enums and Avro enums clearly (as mentioned above), to say nothing of 
the ambiguity of the deserialization process. 
   
   My bias would be to create a Macro that creates an intermediate form that is 
unambiguously convertible between Rust Enum and an Avro compatible entity and 
do the conversion before serialization and after deserialization  (don't try to 
make serde process work outside the avro spec) (and could point to macro in the 
AvroSchema derive error), but I personally haven't been able to think of a 
solution that works for every case. Rust's type system is just most expansive 
that Avro's, so the ambiguity is inevitable at some level.
   
   That being said, I LOVE Rust enums, with a passion, and when I realized I 
couldn't automatically serde them... [I started something that 
could](https://github.com/jklamer/gluino). <-- me shaving the yak.
   
   TLDR: I think it's impossible to do automatically without creating ambiguity 
that I would like to shield most users from. I think doing it as an opt in with 
clearly defined restrictions (and good error messages) would be a good to go 
for advanced users. 
   
   CC @spiegela
   CC @LucasJavaudin 
   


-- 
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]

Reply via email to