Simon Gittins created AVRO-3901: ----------------------------------- Summary: [Rust] Better serde union support Key: AVRO-3901 URL: https://issues.apache.org/jira/browse/AVRO-3901 Project: Apache Avro Issue Type: Improvement Components: rust Affects Versions: 1.11.3 Reporter: Simon Gittins
Want to be able to serde to/from an enum containing structs for a union schema containing record(s): {{{}} {{ "name": "C",}} {{ "type": "record",}} {{ "fields": [}} {{...}} {{ \{"name": "field_union", "type": ["A", "B"]},}} {{...}} {{ ]}} {{}}} With code like: {{struct A \{...}}} {{struct B \{...}}} {{#[serde(untagged)]}} {{{}enum UnionAB \{ A(A), B(B)}{}}}{{{}struct C {{}}} {{ ...}} {{ field_union: UnionAB,}} {{ ...}} {{}}} {{Likewise, want to be able to serde where the schema includes null:}} {{{}} {{ "name": "E",}} {{ "type": "record",}} {{ "fields": [}} {{ ...}} {{ \{"name": "field_union", "type": ["A", "null", "B"]},}} {{ ...}} {{ ]}} {{}}} {{#[serde(untagged)]}} {{enum UnionANoneB {}} {{ A(A),}} {{ None,}} {{ B(B),}} {{}}} -- This message was sent by Atlassian Jira (v8.20.10#820010)