[JavaScript] Getters returning nulls instead of default values for primitives
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- tooling
調査の方向性
まず、jspb.Message.getFieldWithDefault を呼び出す生成済みのプリミティブ getter と、js_out パラメータの解析方法を追跡します。ジェネレーターに既存のオプション処理と、存在する場合は getter 生成のテストを確認します。オプショナルなプリミティブ getter が未設定の値を保持するかどうかを、ドキュメント化されたオプションで制御でき、proto2 の数値フィールドに対するカバレッジがあることを完了条件とします。
索引モデルが issue の本文から書いたものです。
説明
What language does this apply to?
JavaScript
Describe the problem you are trying to solve.
Currently, all generated getters for primitives in _pb.js files call to jspb.Message.getFieldWithDefault and there seem to be no way to tell generator to simply call jspb.Message.getField instead.
This is particularly problematic when using proto2 syntax with required/optional numeric fields. If an optional field is not set, it will default to "0".
Describe the solution you'd like
Ideally there would be an option passed to the js_out parameter of protoc where we could say whether or not to use defaults.
Describe alternatives you've considered
One could potentially leverage hasMyField() to determine if the field has been set or not, but it would make the mapping layer between proto and internal app model even more verbose, as this would need to be done on all optional fields, which we have quite a few.
- 主要言語
- JavaScript
- スター
- 471
- フォーク
- 91
- 平均マージ
- 3時間 57分
- マージ済み PR(30日)
- 2
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
protocolbuffers/protobuf-javascript のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
protocolbuffers/protobuf-javascript#248 · コメント 1 件 · リアクション 13 件 ·
-
question
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
protocolbuffers/protobuf-javascript#222 · コメント 9 件 ·
-
enhancement port-fix triaged
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
protocolbuffers/protobuf-javascript#185 · コメント 1 件 ·
-
enhancement port-fix triaged
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
protocolbuffers/protobuf-javascript#182 · コメント 3 件 · リアクション 1 件 ·
protocolbuffers/protobuf-javascript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mksglu/context-mode#1200 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
neondatabase/website#5944 ·
-
module: core
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
bigbluebutton/bigbluebutton#25849 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
jaegertracing/jaeger-ui#4506 ·