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