gogo / grpc-example

An example of using Go gRPC and tools from the greater gRPC ecosystem together with the GoGo Protobuf Project.
Other
453 stars 87 forks source link

Investigate problem with use of part of message #16

Closed johanbrandhorst closed 6 years ago

johanbrandhorst commented 6 years ago

At work I ran into a problem with the following definition:

service Bla {
    rpc GetBla(GetBlaRequest) returns (Bla) {
        option (google.api.http) = {
            post: "/api/v1/{bla_id}"
            body: "bla"
        };
}

message Bla {
    string something = 1;
}

message GetBlaRequest {
    string bla_id = 1;
    Bla bla = 2;
}

It resulted in an error like:

unexpected type **bla.Bla does not implement proto.Message

The error originates from this line in the generated grpc-gateway code:

if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Bla); err != nil {

I have seen errors like this before in the github.com/gogo/gateway JSONPb marshaller, but thought they were fixed. Investigate whether this is a problem still.

johanbrandhorst commented 6 years ago

It may be this issue should be moved to github.com/gogo/gateway, but I want to reproduce it first.

johanbrandhorst commented 6 years ago

This seems to be working in https://github.com/gogo/grpc-example/blob/8c29208d755fd8246e90d20dbec9545f11d0080e/proto/example.pb.gw.go#L98. Will need to do further investigation.

johanbrandhorst commented 6 years ago

I don't think this is an issue anymore.