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
Even with the ,string modifier, I believe that it should still be parsed according to the JSON number syntax. Users depend on the semantics being well defined so that they can concretely explain to end-users what their services accepts as valid input.
It is simple for users to explain:
This field accepts a JSON number or a JSON string containing a JSON number.
Rather than explaining something more obscure like:
This field accepts a JSON number or a JSON string containing a number that is valid according to the Go grammar for a number.
One of the purposes of JSON is that it's a language agnostic data-interchange format and I think it's a mistake to leak Go-specific details in our implementation. It should theoretically be possible to rewrite a Go service using encoding/json into another language like C++, Rust, Python, etc. and not force the port to implement Go-specific details like how we parse numbers.