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

Possible duplicates of function declarations in service interface #2686

Closed
danielronnkvist opened this issue Mar 12, 2024 · 0 comments · Fixed by #2717
Closed

Possible duplicates of function declarations in service interface #2686

danielronnkvist opened this issue Mar 12, 2024 · 0 comments · Fixed by #2717

Comments

@danielronnkvist
Copy link
Contributor

Problem description

This is an issue with generateServiceClientInterface in proto-loader-gen-types.ts. If the methodName already is in camelCase the generated interface will have duplicate function overloads in the interface.

https://github.com/grpc/grpc-node/blob/cfa80720995d39e50b08d33efbd90e8a93a35a57/packages/proto-loader/bin/proto-loader-gen-types.ts#L558C1-L558C62

Reproduction steps

With a proto file like this:

service Greeter {
  // Sends a greeting
  rpc sayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}

proto-loader-gen-types will generate a service interface like this one:

export interface GreeterClient extends grpc.Client {
  /**
   * Sends a greeting
   */
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, options: grpc.CallOptions, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  /**
   * Sends a greeting
   */
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, options: grpc.CallOptions, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  sayHello(argument: I_google_showcase_v1beta1_HelloRequest, callback: grpc.requestCallback<O_google_showcase_v1beta1_HelloReply>): grpc.ClientUnaryCall;
  
}

Environment

  • OS name, version and architecture: Mac Sonoma version 14.3, Apple M1 Max
  • Node version 20.11.0
  • Node installation method: nvm
  • Package name and version @grpc/proto-loader@0.7.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants