danielgtaylor / danielgtaylor/python-betterproto
Expose request metadata in the generated ```ServiceBase```
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 234
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
```protobuf
service Echo {
rpc Echo(EchoRequest) returns (EchoResponse);
// rpc EchoStream(EchoRequest) returns (stream EchoStreamResponse);
}
```
The generated servicer code generates the code but does not expose the request metadata as a parameter.
```python
class EchoService(EchoBase):
async def echo(self, value: str, extra_times: int) -> "EchoResponse":
return value
async def echo_stream(
self, value: str, extra_times: int
) -> AsyncIterator["EchoStreamResponse"]:
for _ in range(extra_times):
yield value
```
The request metadata is really important since it works like headers in rest-api requests, so this is where a client could add authentication tokens, and also where other metadata could be injected by interceptors for instance.
コントリビューションガイド
調査の方向性
生成された ServiceBase を生成するジェネレーターのエントリーポイントから始め、EchoService の unary メソッドおよびストリーミングメソッドのシグネチャがどのように組み立てられているかを調べます。生成されたメソッドが既存のリクエストフィールドに加えてリクエストメタデータも公開していることを確認し、この出力を対象とする生成テストがある場合は、関連する生成テストを追加または更新します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api, tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100