-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of unknown fields in parameter structs (#32)
Commit 78545e2 disallowed unknown struct fields when unmarshaling parameters. The check could be bypassed by implementing the json.Unmarshaler interface, but the need to do so causes friction for implementations of LSP, which has a loose and rapidly-changing schema (see #5, #31). This changes the default back to ignoring unknown fields, and adds a new optional interface to re-enable strict checking without a custom unmarshaler. N.B.: This is a breaking API change. Relevant changes: - Update UnmarshalParams and UnmarshalResult to check for the target having a DisallowUnknownFields method, and to enable the check for such targets. - Rework the decoding to make the default path do less allocation. - Update documentation and tests.
- Loading branch information
1 parent
ae12d65
commit 1858c65
Showing
4 changed files
with
91 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters