Closed EiffelFly closed 1 year ago
JSON cannot store 64-bit integers, instead only storing double-precision floats (which have a maximum integral precision of 52-bits). As such the specification states to encode 64-bit integers as strings. Decode will work from both representations, double and string, but encode is supposed to only be to string.
WOW, thanks you so much for sharing this information. I didn't notice this at all!
I will close this issue!
I think this is not a bug. I may do something wrong around pb_json to make my response become str not int as expected.
How to replicate
I had reproduced a repo for showcasing the problem I am facing https://github.com/EiffelFly/axum-tonic-string-response.
The protobuf is very simple
This is how I generate the types https://github.com/neoeinstein/protoc-gen-prost (Under the hood it is using pbjson)
And here is the rest_handler
What I expected response will be int but the response I get are both str
Could you shed the light of this issue? I am thinking is there has some sort of flag I didn't setup correctly?