[
https://issues.apache.org/jira/browse/AVRO-3901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17786359#comment-17786359
]
ASF subversion and git services commented on AVRO-3901:
-------------------------------------------------------
Commit 85ddfcdaba60d1cb18a16c9908d737bb32369df7 in avro's branch
refs/heads/avro-3904-SchemaCompatibility--can_read-should-return-Result from
chupaty
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=85ddfcdab ]
AVRO-3901: [Rust] Unit tests and impl for better union support (#2583)
* AVRO-3901: Unit tests and impl for better union support
* Apply suggestions from code review
Rename test cases
Co-authored-by: Martin Grigorov <[email protected]>
* Cleanup from review
* AVRO-3901: Fix formatting, clippy errors and improve naming
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
---------
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
Co-authored-by: Simon Gittins <[email protected]>
Co-authored-by: Martin Grigorov <[email protected]>
Co-authored-by: Martin Tzvetanov Grigorov <[email protected]>
> [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
> Assignee: Martin Tzvetanov Grigorov
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.12.0, 1.11.4
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> (Full code examples in unit tests of attached PR).
> 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)