Kriskras99 commented on PR #458:
URL: https://github.com/apache/avro-rs/pull/458#issuecomment-4103082322

   Hi @PookieBuns, sorry for not responding earlier. I've been working on #512 
and was really hoping to get it finished earlier. It has quite an impact on 
what you're trying to achieve in this PR.
   
   I've adapted your tests to run on #512 
([`nullable_union.rs`](https://gist.github.com/Kriskras99/a8a0209197e612c2c779f9ead0b98971)).
 Note that I've combined the serialize and deserialize tests into a roundtrip 
test.
   
   There are two kinds of tests that fail on my PR. The first kind has expects 
a Option to flatten to the underlying union. These tests are marked as 
`should_panic` in the provided gist as I've explicitly chosen not to support 
this at this point as it adds extra complexity in the serializer/deserializer 
and derive code.
   
   The second kind are the ones with JSON enums. I think I finally understand 
what you're trying to achieve, but please correct me if I'm wrong. You are 
(de)serializing Avro encoded as JSON through `serde_json` into types. Then you 
also want to use those same types to (de)serialized Avro encoded as binary. I 
had originally assumed you were using the `TryFrom<serde_json::Value> for 
Value` and `TryFrom<Value> for serde_json::Value>` implementations. We cannot 
support your usecase of using the same types for binary Avro and JSON Avro (via 
`serde_json`). What is an option is to provide proper support for JSON Avro in 
this crate. That would be through something like `from_json<T: 
Deserialize>(json: serde_json::Value, schema: &Schema>` and `to_json<T: 
Serialize>(value: &T, schema: &Schema)` (don't take this as gospel, there are 
some API considerations to make and you need to deal with schemata).
   
   Please let me know if I understand your usecase correctly and if the 
provided solution would be helpful. Sorry for all the work you put into this 
PR, but I don't think we can merge this.
   


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