Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

grpc loader.defauts does not work to control the response value

オープン
#2,949 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
node.js, typescript
領域
api, backend

調査の方向性

appx ディレクトリにあるリンク先の最小再現から始め、pnpm i に続けて pnpm start:dev を実行します。列挙されている gRPC クライアント間で loader.defaults の挙動を比較し、次に NestJS GRPC トランスポートが loader オプションを @grpc/proto-loader に渡す方法を追跡します。各クライアントのレスポンスをそのオプションで制御すべきかどうかを明らかにし、リポジトリに該当するテストが含まれている場合は対象を絞った回帰テストを追加できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

package: @grpc/proto-loader
Current behavior

we want to get such response from grpc api

{
    "code": 0,
    "statusCode": 1,
    "data": {
        "nullValue": null,
        "zeroValue": 0,
        "message": "great"
    }
}

so we overwrite the options.loader.defaults to get the zero value code item as follows:

app.connectMicroservice(
    {
      transport: Transport.GRPC,
      options: {
        url: '0.0.0.0:6000', // gRPC 服务的地址和端口
        package: 'hello', // proto 文件中的 package 名称
        protoPath: join(__dirname, '../proto/hello.proto'), // proto 文件路径
        loader: {
          defaults: true, // expected to get the zero value code in response
          arrays: true,
          objects: true,
          json: true,
        },
      },
    },

but we when I tested the result, I get confused because the result are not the same rule.

  • with Postman we always get the zero value code in response whether loader.defaults is true
  • with GRPC Client code we always get the zero value code in response whether loader.defaults is true
  • with grpcurl we always cannot get the zero value code in response whether loader.defaults is true
  • with Jetbrains HTTPClient we always cannot get the zero value code in response whether loader.defaults is true
Minimum reproduction code

https://github.com/rawbin-/nest-grpc-test/tree/main/appx

Steps to reproduce
pnpm i
pnpm start:dev

test with any grpc client tool

Expected behavior

loader.defaults can control the result

Packages versions
"@grpc/grpc-js": "^1.13.3",
    "@grpc/proto-loader": "^0.7.15",
    "@nestjs/common": "^10.0.0",
    "@nestjs/core": "^10.0.0",
    "@nestjs/microservices": "^11.1.0",
    "@nestjs/platform-express": "^10.0.0",
    "grpc": "^1.24.11",
    "reflect-metadata": "^0.2.0",
    "rxjs": "^7.8.1"
Node.js version

v18.20.7

In which operating systems have you tested?
  • macOS
  • Windows
  • Linux
主要言語
TypeScript
スター
4.8k
フォーク
716
平均マージ
1日 18時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

grpc/grpc-node のほかの issue

grpc/grpc-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。