openapi-generators / openapi-generators/openapi-python-client

Handle "empty" default values as null

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

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

主要言語
Python
スター
2k
フォーク
293
平均マージ
34分
マージ済み PR(30日)
1

説明

Describe the bug
"empty" default values for optional fields throw an error. swagger-parser explicitly allows these (even though they are technically out-of-spec) by converting them silently to null. So, there exist openapi json in the wild built by swagger tools that pass swagger validation, but throw an error here in openapi-python-client.

OpenAPI Spec File
https://www.marinespecies.org/rest/api-docs/openapi.yaml

grep for:

                schema:
                    type: integer
                    default: ""

There are three endpoints that have this property. One of which is AphiaTaxonRanksByID. It might be useful to check this endpoint out in the swagger docs here.

Desktop (please complete the following information):

  • openapi-python-client version 0.28.0

Additional context
I am in contact with the folks at WORMS to try and find out how their openapi.yaml got this way. Will update here when I get more info.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

Issue にリンクされている海洋生物種の OpenAPI ファイルを使って失敗を再現します。特に type: integerdefault: "" を含むスキーマを重点的に確認します。クライアント生成中にオプションフィールドのデフォルト値がどのように処理されるかを追跡し、swagger-parser による記載された処理と動作を比較します。影響を受けるエンドポイントが正常に生成され、空のデフォルト値が null として扱われれば完了です。

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

評価

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

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

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