Define int in proto but got string
anotherGoogleFan opened this issue · 3 comments
anotherGoogleFan commented
My proto is like this:
syntax = "proto3";
package prototest;
option go_package = ".;prototest";
import "github.com/metaverse/truss/deftree/googlethirdparty/annotations.proto";
service Test {
rpc Add1(add1Request) returns(Add1Response){
option (google.api.http) = {
post: "/add_1"
body: "*"
};
}
}
message add1Request{
uint64 ori = 1;
}
message Add1Response{
uint64 ans = 2;
}
AND I post a request:
HTTP POST: http://127.0.0.1:5050/add_1
{
"ori": 15
}
I got the response like this:
{
"ans": "16"
}
but in proto file, I define ans is an int, not string.
I think the response should be like this:
{
"ans": 16
}
anotherGoogleFan commented
I tried many times and found that it seems like a bug in github.com/gogo/protobuf/jsonpb
.
I raise an issue: gogo/protobuf#718
zwiedmann-isp commented
hey sorry for the delay, we have a fork of jsonpb in
github.com/metaverse/protobuf -- in my projects i simply use modules to
replace the import and thatll make your int64s numbers again.
…On Sun, Jan 17, 2021, 6:05 PM HuangTao ***@***.***> wrote:
I tried many times and found that it seems like a bug in
github.com/gogo/protobuf/jsonpb.
I raise an issue: gogo/protobuf#718
<gogo/protobuf#718>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#323 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APUUNDVNZ2FYIKKTHEOJFULS2OJQJANCNFSM4WD2VZHA>
.
anotherGoogleFan commented
Thanks a lot. That solve my problem.