Skip to content

Return an error on unknown JSON fields #46

@smyrman

Description

@smyrman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions