diff --git a/CHANGELOG.md b/CHANGELOG.md index 47e88b9..21d607c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ * New option `IgnoreUntaggedFields` to ignore decoding to any fields without `mapstructure` (or the configured tag name) set [GH-277] +* New option `ErrorUnset` which makes it an error if any fields + in a target struct are not set by the decoding process. [GH-225] * Decoding to slice from array no longer crashes [GH-265] * Decode nested struct pointers to map [GH-271] * Fix issue where `,squash` was ignored if `Squash` option was set. [GH-280] diff --git a/mapstructure.go b/mapstructure.go index 995c84b..32c9fce 100644 --- a/mapstructure.go +++ b/mapstructure.go @@ -217,7 +217,8 @@ type DecoderConfig struct { // If ErrorUnset is true, then it is an error for there to exist // fields in the result that were not set in the decoding process - // (extra fields). + // (extra fields). This only applies to decoding to a struct. This + // will affect all nested structs as well. ErrorUnset bool // ZeroFields, if set to true, will zero fields before writing them.