[
https://issues.apache.org/jira/browse/AVRO-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin Tzvetanov Grigorov resolved AVRO-3692.
---------------------------------------------
Fix Version/s: 1.12.0
1.11.2
Assignee: Martin Tzvetanov Grigorov
Resolution: Fixed
> Serde flatten is not supported when deserializing
> -------------------------------------------------
>
> Key: AVRO-3692
> URL: https://issues.apache.org/jira/browse/AVRO-3692
> Project: Apache Avro
> Issue Type: Improvement
> Components: rust
> Reporter: Ten
> Assignee: Martin Tzvetanov Grigorov
> Priority: Trivial
> Labels: pull-request-available
> Fix For: 1.12.0, 1.11.2
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> The following:
> {code:java}
> #[test]
> fn test_from_value_struct_flatten() {
> #[derive(Deserialize, PartialEq, Debug)]
> struct S1 {
> f1: String,
> #[serde(flatten)]
> inner: S2,
> }
> #[derive(Deserialize, PartialEq, Debug)]
> struct S2 {
> f2: String,
> }
> let expected = S1 {
> f1: "Hello".to_owned(),
> inner: S2 {
> f2: "World".to_owned(),
> },
> }; let test = Value::Record(vec![
> ("f1".to_owned(), "Hello".into()),
> ("f2".to_owned(), "World".into()),
> ]);
> let final_value: S1 = from_value(&test).unwrap();
> assert_eq!(final_value, expected);
> } {code}
> fails to deserialize.
> This is due to serde hinting for map deserialization when structs contain
> flatten. It is super easy to fix, I'm opening a PR.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)