-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Marshalling of response object is bad for int64 properties #920
Comments
Hey @donutloop, thanks for sending in the issue. This has been discussed quite extensively in #219 (comment), #438, #735 and a few more. It's unlikely to change because there is a correctness issue, and we have no ability to change without dramatically changing the way JSON is handled in the core of protobuf (which would require an ecosystem wide migration). Do you have any ideas on how could we make this behavior more obviously correct? Did you look in our documentation before filing an issue? If so, where so I can add more links and words. Thanks so much! |
Have you opened a ticket on this protobuffer repository to discuss this issue in detail? It's definitely a major bug and it should be get fixed by this protobuffer team |
@donutloop, thanks for the response. Based on this comment, do you really think it is a bug to handle things this way?
is a sentiment that really scares me as an API designer and I'm generally in agreement with the protobuf team that this is the correct design even if it is unintuitive. Could you elaborate a bit on why you think it is a "major bug"? |
…nverts (u)int64 to strings (see: grpc-ecosystem/grpc-gateway#920 ), which is compliant with the Proto3 spec. However, this affects our response negatively because it breaks backwards compatibilty. Go's JSON encoder/decoder doesn't have such surprises. This commit replaces runtime.JSONPb (from gRPC-Gateway) with a wrapper around the stdlib JSON encoder/decoder.
I faced this behavior on the step of testing my rest service. |
You can specify your own Marshaller with the runtime.WithMarshaler option. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
What version of protobuf and what language are you using?
Version: libprotoc 3.7.0
Language: GOLANG
Version v1.3.1
What version of Go are you using (
go version
)?go version go1.12 darwin/amd64
What operating system (Linux, Windows, …) and version?
MacOS Mojave 10.14.1 (18B75)
What did you do?
i had defined a message in Protobuffer this message contains a property called "property name: status, type:int64". if i send a response to the requester then i get instead of "int" a "string" as type back.
Input:
What did you expect to see?
Output:
What did you see instead?
Output:
The text was updated successfully, but these errors were encountered: