go-chi / go-chi/render

is possible to apply 'dec.DisallowUnknownFields()' to render.Bind ?

Open
#50 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
339
Forks
66
PR merge metrics
No merged PRs in 30d

Description

🙋🏻‍♂️ Hello! I am starting with chi for my personal project. Is there some way to return an error if the received json request has an additional unexpected field?
Using the json.NewDecode(r.body) we can set `dec.DisallowUnknownFields()` and when we unmarshal the json object via Decode method we get that information error in the err value `err := dec.Decode(&someStructType)`
I am seeing the chi examples but I don't find examples about it.

Thanks for your assistance!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.