Theodlz commented on issue #247:
URL: https://github.com/apache/avro-rs/issues/247#issuecomment-3574903206

   Gotcha. However it's a bit unfortunate that even if I provide a valid schema 
- that accounts for the flattening - it can't be used because the flatten macro 
isn't accounted for by the writer. This means that a given struct can't 
necessarily be converted to an avro schema that matches the structure followed 
by other serde-friendly crates, i.e. the user needs to edit their structs to 
reach a specific output schema.
   
   Just to explain my usecase a bit:
   1. I read in an avro packet with a LOT of fields as a struct
   2. I compute a bunch of values from that struct's fields, and I create a new 
struct that contains the original one (with a serde flatten) + the new fields I 
computed
   3. I want to put that out as an avro that looks like the original + my added 
fields.
   
   Serde's `flatten` macro is particularly elegant when one wants to "augment" 
data without writing a gazillion lines of code redefining fields that already 
exist in another struct. Anyways I just wanted to explain why we rely on it. 
But if there is no plan to support that serde macro, then we'll most likely 
have to just redefine these large structs in multiple places to avoid the 
flatten.
   
   (@petebachant tagging you here so you know about this issue)


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