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

   I've played with this code for a few hours now, and I think I finally 
understand at least some problems.
   
   When it comes to simple vs complex enums handling, Serde is too generic and 
doesn't allow distinguishing between Enum variants with or without values. But 
for Avro the difference is quite significant.
   
   If we take this code:
   ```rust
   enum One {
        A,
        B
   }
   
   enum Two {
        A,
        B(String)
   }
   
   enum Three {
        A(i32),
        B(String)
   }
   // And all other gazillion variations
   ```
   Serde will straight call `serialize_unit_variant` on each variant, so the 
code will always output simple or complex enums.
   
   An obvious way to solve it, although not very convenient, would be to create 
an attribute or derive proc-macro that generates serializer and deserializer 
for enums since proc-macros can get all the required information.
   
   Maybe Serde feature that would help here could be requested from, but I 
don't know if it's even possible to introduce such a significant change at this 
point.
   
   ---
   
   I think the other issues like the ones mentioned in 
https://github.com/apache/avro/pull/1921#issuecomment-1466859552 are at least 
in some part caused by this "simple vs complex enums handling".


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