zenrpc icon indicating copy to clipboard operation
zenrpc copied to clipboard

Return an error on unknown JSON fields

Open smyrman opened this issue 5 years ago • 0 comments

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 avatar Oct 30 '19 12:10 smyrman