Skip to content
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

When returned other types, the generated code is incorrect #336

Open
GGXXLL opened this issue Aug 4, 2021 · 0 comments
Open

When returned other types, the generated code is incorrect #336

GGXXLL opened this issue Aug 4, 2021 · 0 comments

Comments

@GGXXLL
Copy link

GGXXLL commented Aug 4, 2021

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant