zenrpc
zenrpc copied to clipboard
Return an error on unknown JSON fields
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.