I finally managed to create a serde::Deserialize
implementation that would support flatten
and deny_unknown_fields
at the same time. The issue was mostly how the Serde API makes this task difficult for no good reason from what I can tell.
I sort of see why it has to be static strings everywhere, but why static slices as well? That’s an implementation detail of the default implementation and IMHO not actually required anywhere. And why is it so hard to get to the list of fields supported by an implementation?
I guess this use case was never a priority, but configuration files where a typo in a field name won’t be recognized are a major PITA…