79321137

Date: 2025-01-01 04:11:56
Score: 0.5
Natty:
Report link

In Nestjs default it will omit any fields that have an empty array. To also take properties have an empty array. You can configure it on the loader options, make sure you install @grpc/proto-loader. Example:

const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule, {
  transport: Transport.GRPC,
  options: {
    package: 'hero',
    protoPath: join(__dirname, 'hero/hero.proto'),
    loader: {
        defaults: true,
        arrays: true,
      },
    },
});

Nestjs: https://docs.nestjs.com/microservices/grpc#options
Proto-loader: https://github.com/grpc/grpc-node/blob/master/packages/proto-loader/README.md

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Phát Đỗ