Closed klebs6 closed 8 months ago
fixed with this workaround (for example)
#[derive(Clone,Debug,Serialize, Deserialize)]
pub struct Transaction {
#[serde(flatten)]
inner: TransactionInner,
}
#[derive(Clone,Debug,Serialize, Deserialize)]
#[serde(untagged)]
enum TransactionInner {
V1 {
#[serde(rename = "Date")]
#[serde(with = "naive_date_format")]
date: NaiveDate,
},
V2 {
#[serde(rename = "Posted Date")]
#[serde(with = "naive_date_format")]
posted_date: NaiveDate,
},
}
What version of the
csv
crate are you using?Briefly describe the question, bug or feature request.
unexpected behavior (bug?) when using serde
untagged
with an enum to deserialize csv dataInclude a complete program demonstrating a problem.
What is the observed behavior of the code above?
What is the expected or desired behavior of the code above?
both tests should pass and the data should deserialize properly into the V1 variant. if we add variants with different layouts to the MyUntaggedEnum, we should still be able to deserialize the CSV_DATA into the V1 variant.