Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

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

Merged
mitchellh merged 1 commit intomitchellh:masterfrom
SaschaRoland:unset-fields
Apr 20, 2022
Merged

Add ErrorUnset option to DecoderConfig and Unset array to Metddata#225
mitchellh merged 1 commit intomitchellh:masterfrom
SaschaRoland:unset-fields

Conversation

@SaschaRoland
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Owner

Really clean PR, thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants