PookieBuns commented on code in PR #519:
URL: https://github.com/apache/avro-rs/pull/519#discussion_r3031672800


##########
avro/src/serde/derive.rs:
##########
@@ -590,11 +593,16 @@ where
         named_schemas: &mut HashSet<Name>,
         enclosing_namespace: NamespaceRef,
     ) -> Schema {
-        let variants = vec![
-            Schema::Null,
-            T::get_schema_in_ctxt(named_schemas, enclosing_namespace),
-        ];
-
+        let variants = match T::get_schema_in_ctxt(named_schemas, 
enclosing_namespace) {
+            Schema::Union(union) if 
union.index_of_schema_kind(SchemaKind::Null).is_some() => {
+                union.schemas

Review Comment:
   updated 
[here](https://github.com/apache/avro-rs/pull/519/changes/66b6d52ccc46dddf8d1eb2eb5a82f12566888db7)!
   
   On a side note though (and probably out of scope), do we want to panic for 
library generated impls? Because we have no control over how people define 
their structs so if they define a struct with `Option<Option<T>>` getting the 
schema would cause a panic... Maybe returning result would be a potential 
option (pun not intended)? (Though its a breaking change)



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