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

Support DisallowUnknownFields in JSON #1649

Closed
wants to merge 1 commit into from
Closed

Support DisallowUnknownFields in JSON #1649

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 18, 2018

Currently it is not possible to tell the default JSON binder to use DisallowUnknownFields (supported by jsoniter and default Go json decoder). Use package variable EnableDecoderKnownFieldsOnly as a switch.

Current it is not possible to tell the default JSON binder to use DisallowUnknownFields (supported by jsoniter and default Go json decoder). Use package variable EnableDecoderKnownFieldsOnly as a switch.
@ghost ghost closed this Nov 19, 2018
@tcr-ableton
Copy link

Why is this closed, I could really use this too 👍

@kszafran
Copy link
Contributor

@tcr-ableton I would also find this feature useful. I created this PR: #2028

@ghost ghost reopened this Sep 4, 2019
@codecov
Copy link

codecov bot commented Sep 4, 2019

Codecov Report

Merging #1649 into master will decrease coverage by 0.24%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1649      +/-   ##
==========================================
- Coverage   99.28%   99.04%   -0.25%     
==========================================
  Files          40       43       +3     
  Lines        1971     2938     +967     
==========================================
+ Hits         1957     2910     +953     
- Misses         10       19       +9     
- Partials        4        9       +5
Impacted Files Coverage Δ
binding/json.go 95.83% <100%> (-4.17%) ⬇️
render/json.go 95.37% <0%> (-4.63%) ⬇️
response_writer.go 96.72% <0%> (-3.28%) ⬇️
logger.go 98.7% <0%> (-1.3%) ⬇️
recovery.go 98.93% <0%> (-1.07%) ⬇️
context.go 99.27% <0%> (-0.23%) ⬇️
debug.go 95.65% <0%> (-0.1%) ⬇️
auth.go 100% <0%> (ø) ⬆️
binding/form.go 100% <0%> (ø) ⬆️
render/redirect.go 100% <0%> (ø) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6b2c13...e7f3a0e. Read the comment docs.

@ghost
Copy link
Author

ghost commented Sep 4, 2019

I've reopened the PR. It's possible to write your own binder and implement this behaviour that way however it seems like a nothing to add it here too.

@appleboy appleboy changed the title Update json.go Support DisallowUnknownFields in JSON Sep 5, 2019
@appleboy appleboy added this to the 1.5 milestone Sep 5, 2019
@appleboy
Copy link
Member

appleboy commented Sep 5, 2019

move to #2028

@appleboy appleboy closed this Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants