-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Convert the first letter of method name to upper #300
Conversation
Thanks for your contribution. Can you sign the CLA and demonstrate this behavior in an example or a test? |
All right. I have signed the CLA. It seems a little hard to write test code into current test cases, the tests are ran on a mock output of protoc but this pr focus on fix the issue of integration with protoc-go. Here's the test case: Write a protobuf file:
Pay attention to the method This will generate the go source code file with the following codes: func (c *someServiceClient) List(ctx context.Context, in *SomeRequest, opts ...grpc.CallOption) (*SomeResponse, error) {
out := new(SomeResponse)
err := grpc.Invoke(ctx, "/test.SomeService/list", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
} The method name is Run the grpc gateway compile command: The generated grpc gateway code:
Take a look at The protobuf official document says:
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
1 similar comment
I signed it! |
CLAs look good, thanks! |
Convert the first letter of method name to upper
It'll generate wrong method name if the method name starts with a lower-case letter in the proto file of gRPC.
The code generation rule of protoc-go will convert the first letter to upper-case but grpc-gateway do not.
So I just slightly changed the method name before applying the template.