Navigation Menu

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

Add ErrorUnset option to DecoderConfig and Unset array to Metddata #225

Merged
merged 1 commit into from Apr 20, 2022

Conversation

SaschaRoland
Copy link
Contributor

This commit extends the DecoderConfig with an option to fail decoding
if there exist fields in the target struct, which haven't been set
during decoding due to a missing, corresponding value in the input map.

Accordingly, the Metadata has been extended with an Unset array to
receive all field names which have not been set during decoding.

This commit extends the DecoderConfig with an option to fail decoding
if there exist fields in the target struct, which haven't been set
during decoding due to a missing, corresponding value in the input map.

Accordingly, the Metadata has been extended with an Unset array to
receive all field names which have not been set during decoding.
@mitchellh
Copy link
Owner

Okay, I like this. See my comment in #167 for what seems contradictory, but the reason I like this is because its purely related to decoder state. Its possible #167 could be construed this way too so maybe I'm just looking at this from another angle. I like that this isn't a per-field "validation" pass, its more of a decode-behavior validation and metadata extraction.

@mitchellh mitchellh merged commit 8385cfa into mitchellh:master Apr 20, 2022
@mitchellh
Copy link
Owner

Really clean PR, thank you

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

Successfully merging this pull request may close these issues.

None yet

3 participants