metaverse/truss

Define int in proto but got string

anotherGoogleFan opened this issue · 3 comments

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
}

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

Thanks a lot. That solve my problem.