Support for responses with no body (like 204)

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
openapi, typescript

調査の方向性

まず、OpenAPI 定義に body がないレスポンスについて、生成された api.ts HttpClient と functions.ts のメソッドを追跡します。HttpResponse のデータとエラー値、response.ok、responseresponseFormat、および nullable な TypeScript ジェネリクスがどのように扱われているかを確認します。204 スタイルのレスポンスで body のパースを回避し、型エラーなしで利用可能な成功結果を公開できれば完了です。

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

説明

Currently the generated api.ts HttpClient class doesn't support responses that return 204.

It would be good for it to support that when a openapi spec response has no body defined.

path:
  /customers/:customerId
    delete:
      parameters:
        - name: customerId
          in: path
          required: true
          schema:
            type: integer
          description: Customer ID
      responses:
        '204':
          description: Customer removed

This means also if there's no body,

  • the current data or error HttpResponse needs to handle success cases where data is not returned, such as by returning the Response.ok field, for use for the functions.ts method
  • to not call response[responseFormat]()
  • to handle typescript generics in a way that allows nullable response types
主要言語
TypeScript
スター
4
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

hasura/ndc-open-api-lambda のほかの issue

hasura/ndc-open-api-lambda の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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