Skip to content

cannot combine prefix with deny_unknown_fields #57

Answered by jonasbb
fbenkstein asked this question in Q&A
Discussion options

You must be logged in to vote

I looked more into the underlying implementation to understand the issue better. Deserializing something as struct or enum does consume the values and ensures they cannot be processed twice. Processing it as a map will not consume the values. This was a deliberate change to serde to allow using the withprefix implementation (serde-rs/serde@5ee2fc0).

Now the withprefix wrapper deserilizes the data like a map. It has to do this, because it does not care about the wrapped type. It is fully based on checking or adding the prefix during runtime, which makes it possible to work with all types, not just types where the definition is known.

Changing the implementation to deserialize like a struct…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jonasbb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #57 on December 16, 2020 20:16.