So I'm trying to find a solution to consume the following YAML with a Struct:
entries:
- alias: xyz
real_name: abc
- hjkl
Why do I have a single string mixed with a map? The single string means that both "alias" and "real_name" map entries have the same value.
I can probably handle this scenario using serde_yaml::Value but I wanted to confirm that it cannot be resolve through serde macro that could set a custom micro-parse for it. Something like:
Just to confirm, you want something like YamlFile {entries: vec![Entry {alias: "xyz", real_name: "abc"}, Entry {alias: "hjkl", real_name: "hjkl"}] as a result?
The derived Deserialize for EntrySer does the actual parsing of the two cases, and the manual Deserialize for Entry converts that into the desired data structure.