Nest: gRPC Client does not send fields when field name contains underscore

Created on 16 Jun 2020  路  4Comments  路  Source: nestjs/nest

Bug Report

Current behavior

Having a Nestjs gRPC Client using a .proto file that contains message field names with an underscore leads to those fields not being sent and thus falling back to their defaults.

Input Code

Does not work:

message ConfigNew {
    int32 id = 1;
    string test_string = 2;
}

works:

message ConfigNew {
    int32 id = 1;
    string teststring = 2;
}

Expected behavior

Support for message field names, regardless whether they contain an underscore or not.

Environment


- Nest version: 7.2.0
- Node version: v12.16.2
- Platform: Linux
needs clarification

Most helpful comment

All 4 comments

Please provide a minimum reproduction repository.

set keepCase option to true in microservice options.
I think this option should be true by default, it's not at the moment.
Like this:

app.connectMicroservice<MicroserviceOptions>({
    transport: Transport.GRPC,
    options: {
      package: 'test',
      protoPath: 'path/to/proto',
      loader: { keepCase: true },
    },
  });

set keepCase option to true in microservice options.
I think this option should be true by default, it's not at the moment.
Like this:

app.connectMicroservice<MicroserviceOptions>({
    transport: Transport.GRPC,
    options: {
      package: 'test',
      protoPath: 'path/to/proto',
      loader: { keepCase: true },
    },
  });

Yes, you are right! It works as expected when setting the loader options, thank you.
I think we should either enable this by default (if applicable) or at least mention in the docs, what do you guys think?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

breitsmiley picture breitsmiley  路  3Comments

rlesniak picture rlesniak  路  3Comments

thohoh picture thohoh  路  3Comments

VRspace4 picture VRspace4  路  3Comments

JulianBiermann picture JulianBiermann  路  3Comments