Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate parse errors inside a flattened Option struct #2751

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

johnmave126
Copy link

This is an attempt to address serde-rs/json#644

The idea is to go through a proxy type OptionFlatMapDeserializer when calling deserialize_option in FlatMapDeserializer. Such proxy type provides a custom error type FlatStructError which only catches missing_field error during the immediate struct deserialization. All the errors happening nested will be preserved in another variant. In this way, we could propagate error inside a flattened struct.

I guess some more tests and comments are needed, but I want to put this work forward for preliminary test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant