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

Is It Possible to Expose Request/Response Types for Service Method Definitions #205

Open
kudla opened this issue Apr 7, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@kudla
Copy link

kudla commented Apr 7, 2023

Hi @thesayyn!
While using directly loadSync from @grpc/proto-loader (comparing to protoc-gen-ts) it populates a service description additionally with requestType and responseType definitions. E.g.

{
  ServiceName: {
    MethodName: {
      path: '/ServiceName/MethodName',
      requestStream: false,
      responseStream: false,
      requestSerialize: [Function: serialize],
      requestDeserialize: [Function: deserialize],
      responseSerialize: [Function: serialize],
      responseDeserialize: [Function: deserialize],
      originalName: 'methodName',
//--------------------------------------
      requestType: [Object],
      responseType: [Object]
//--------------------------------------
    },
}

Is it possible to achieve the same with the protoc-gen-ts it self. Because for now the only solution I can see is just to abuse UnimplementedServiceNameService.definitiion and to inject it there manually. Or just to export full definitions separately.

Or is there any more pure designed solutions to have these definition within protoc-gen-ts classes?

I'm not really sure whether my huck solution will work at all since a final Client class extended from grpc_1.makeGenericClientConstructor( already wrapped the definition once I've been imported it. I'l take a try.

Thx.

@thesayyn
Copy link
Owner

thesayyn commented Mar 1, 2024

Hmm, this looks like a new property introduced in a newer version of @grpc/grpc-js. I'd be happy to take contribution.

@thesayyn thesayyn added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants