You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ValidateRequestBody function fails to identify the request body as invalid. The problems seem to be related to the unmarshalling of the json.
I think it's related to this: golang/go#24415
When the json is decoded, the second address is removed and the "real" input is never validated.
Indeed it's encoding/json's fault IMO and I am missing where encoding/json.Unmarshal covers decoding multiple map keys. I'm not sure the JSON "initial spec" (at least) covers it.
There are many corners of the JSON format that are unclear (repeated keys, comments, integer precision...) so I would encourage you to open a PR that at least errors out when unmarshalling duplicate keys but realistically (some tools out there surely rely on this behavior somehow) the best option for you is to RegisterBodyDecoder to a stricter jsonBodyDecoder.
Sorry :)
(I'd like you to PR your own jsonBodyDecoder though please)
Hi,
I'm trying to validate this (invalid) json
with this schema
The
ValidateRequestBody
function fails to identify the request body as invalid. The problems seem to be related to the unmarshalling of the json.I think it's related to this: golang/go#24415
When the json is decoded, the second address is removed and the "real" input is never validated.
Code to reproduce:
The text was updated successfully, but these errors were encountered: