[
https://issues.apache.org/jira/browse/AVRO-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated AVRO-3692:
---------------------------------
Labels: pull-request-available (was: )
> 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
> Priority: Trivial
> Labels: pull-request-available
> Time Spent: 10m
> 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)