Kriskras99 commented on code in PR #519:
URL: https://github.com/apache/avro-rs/pull/519#discussion_r3020968332
##########
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:
This must panic. Otherwise `Option<Enum { A, B(String) }>` is equivalent to
`Enum { A, B(String) }`, so you would never be able to deserialize
`Some(Enum::A)`.
--
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]