#2384·serde

Document that flatten + deny_unknown_fields works at least in simple cases

Author: safinaskarCreated Feb 25, 2023Updated Jul 6, 2026
Labelsdocs

Hi. I did some experiments and I see that flatten + deny_unknown_fields combination works in some simple cases, such as this: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=770a45f208ac8cbef83e968a87ca4f31 , despite docs say that this doesn't work: https://serde.rs/field-attrs.html#flatten .

On the other hand complex cases, such as this: https://github.com/serde-rs/serde/issues/2283 seem to not be supported.

So, please, document cases when this combination is supported, I want to rely on this feature in my code