use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
#[serde(tag = "version")]
enum Outer {
V1(OuterContent),
}
#[derive(Serialize, Deserialize)]
struct OuterContent {
a: Inner,
}
#[derive(Serialize, Deserialize)]
enum Inner {
M {},
}
fn main() {
let obj = Outer::V1(OuterContent { a: Inner::M {} });
let b = serde_yaml::to_string(&obj).unwrap();
println!("{}", b);
let obj = serde_yaml::from_str::<Outer>(&b).unwrap();
}
The above code failed with output:
version: V1
a: !M {}
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("a: untagged and internally tagged enums do not support enum input", line: 2, column: 4)', src/main.rs:25:49
This bug is introduced in version 0.9. Maybe it has something to do with !tag syntax.
Related: #344
The above code failed with output:
This bug is introduced in version 0.9. Maybe it has something to do with
!tag
syntax. Related: #344