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

Improve handling of unknown fields in parameter structs #32

Merged
merged 8 commits into from
Nov 18, 2020

Conversation

creachadair
Copy link
Owner

@creachadair creachadair commented Nov 18, 2020

Fixes #31.

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.

base.go Outdated Show resolved Hide resolved
- Unexport the StrictFielder interface.
- Rename the method to DisallowUnknownFields.
- Fix some documentation errors.
When unmarshaling parameters without the strict field check, don't create a
byte reader and decoer; just call json.Unmarshal directly.
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.

Enabling loose unmarshaling of requests
2 participants