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

Return an error on unknown JSON fields #46

Open
smyrman opened this issue Oct 30, 2019 · 0 comments
Open

Return an error on unknown JSON fields #46

smyrman opened this issue Oct 30, 2019 · 0 comments
Labels

Comments

@smyrman
Copy link

smyrman commented Oct 30, 2019

When either using named arguments, or when passing arguments into struct parameters, it would be good for the generated zenrpc API to return an error on unkown fields.

This is detectable today in the standard library by initializing a json.Decoder and calling DisallowUnknownFields on it.

https://golang.org/pkg/encoding/json/#Decoder.DisallowUnknownFields

The problem with just using json.Unmarshal as the generated code does today, is that user of the API won't easily discover when they have named parameters wrongly, as there are no clear error messages.

@smyrman smyrman changed the title Return error on unknown fields. Return an error on unknown JSON fields Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants