Skip to content

Add a way to pass loader options to custom grpc-loader #13930

Closed
@eladhaim

Description

@eladhaim

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

We heavily rely on protobuf and use ts-proto to generate our package definitions. To handle the generated code, we've had to create our own gRPC loader. However, while we have the option to pass a custom gRPC loader, we currently cannot pass custom gRPC options. Ideally, we'd like the loader object within GrpcOptions to be of type any or a generic type that we can override to customize the options as needed.

Describe the solution you'd like

Our problem is just a type issue, converting the loader object to any/generic with default will do the job.

Teachability, documentation, adoption, migration strategy

Today:

     ClientsModule.register([
      {
        name: 'GRPC_CLIENT_NAME',
        transport: Transport.GRPC,
        options: {
          package: 'testPackage',
          protoPath: 'proto_path',
          protoLoader: 'our custom loader',
          url: 'localhost:4001',
          loader: {
             // @ts-ignore
             newOption: 'new option'
          },
        },
      }
    ]),

After the change:

   ClientsModule.register([
   {
     name: 'GRPC_CLIENT_NAME',
     transport: Transport.GRPC,
     options: {
       package: 'testPackage',
       protoPath: 'proto_path',
       protoLoader: 'our custom loader',
       url: 'localhost:4001',
       loader: {
          newOption: 'new option'
       },
     },
   }
 ])

What is the motivation / use case for changing the behavior?

Adding more flexibility to the server/client of grpc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions