[
https://issues.apache.org/jira/browse/AVRO-3901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated AVRO-3901:
---------------------------------
Labels: pull-request-available (was: )
> [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
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Want to be able to serde to/from an enum containing structs for a union
> schema containing record(s):
> {code:json}
> {
> "name": "C",
> "type": "record",
> "fields": [
> ...
> {"name": "field_union", "type": ["A", "B"]},
> ...
> ]
> }
> {code}
> With code like:
> {code:c}
> struct A {...}
> struct B {...}
> #[serde(untagged)]
> enum UnionAB { A(A), B(B)}
> struct C {
> ...
> field_union: UnionAB,
> ...
> }
> {code}
> Likewise, want to be able to serde where the schema includes null:
> {code:json}
> {
> "name": "E",
> "type": "record",
> "fields": [
> ...
> {"name": "field_union", "type": ["A", "null", "B"]},
> ...
> ]
> }
> {code}
> {code:c}
> #[serde(untagged)]
> enum UnionANoneB {
> A(A),
> None,
> B(B),
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)