metaverse/truss

When returned other types, the generated code is incorrect

GGXXLL opened this issue · 0 comments

such as google.protobuf.StringValue

proto file:

syntax = "proto3";

package pb;

import "google/api/annotations.proto";
import "google/api/httpbody.proto";
import "google/protobuf/wrappers.proto";

service Hello {
  rpc Helloworld (HelloworldRequest) returns (google.protobuf.StringValue) {
    option (google.api.http) = {
      get: "/hello/"
    };
  }
}

message HelloworldRequest {
  string name = 1;
}

the generated code:

func (s helloService) Helloworld(ctx context.Context, in *pb.HelloworldRequest) (*pb.StringValue, error) {
	var resp pb.StringValue
	return &resp, nil
}

It should be

import types "github.com/gogo/protobuf/types"

...

type HelloServer interface {
	Helloworld(context.Context, *HelloworldRequest) (*types.StringValue, error)
}