Support plain text errors

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

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

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

評価

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

調査の方向性

progenitor-client/src/progenitor_client.rs から始め、特に from_response とその fmt::Debug バウンドを確認してから、issue の YAML 例から生成を再現します。生成されたクライアントが text/plain の文字列エラーレスポンスに対してコンパイルでき、そのレスポンスをサポートされていない ByteStream バウンドを要求せずに処理できれば完了です。

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

説明

Hi,

I have a spec where the error message is of string type and the mime type is plaintext:

/some/path:
  post:
    responses:
      '200': ...
      '500':
        description: Server error
        content:
          text/plain; charset=utf-8:
            schema:
              type: string

This gets generated into a method returning Result<ResponseValue<_>, Error<ByteStream>>. The problem happens when deserialize the response:

match response.status().as_u16() {
    200u16 => ResponseValue::from_response(response).await,
    500u16 => Err(Error::ErrorResponse(ResponseValue::stream(response))),
    _ => Err(Error::UnexpectedResponse(response)),
}

The from_response method has a bound to fmt::Debug on the error type, which is not implemented for ByteStream, thus failing compilation.

I worked around it by simply removing the bound, but I'm wondering if there's a better solution. I can also open a PR to fix it if this workaround is good.

主要言語
Rust
スター
1k
フォーク
142
平均マージ
19時間 13分
マージ済み PR(30日)
16

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

oxidecomputer/progenitor のほかの issue

oxidecomputer/progenitor の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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