openapi-generators / openapi-generators/openapi-python-client
Handle "empty" default values as null
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 2k
- 分支
- 293
- 平均合併
- 34 分鐘
- 30 天內合併 PR
- 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.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用 issue 中連結的海洋物種 OpenAPI 檔案重現此故障,特別關注包含 type: integer 和 default: "" 的 schema。追蹤用戶端產生過程中選用欄位預設值的處理方式,並將其行為與所述的 swagger-parser 處理方式進行比較。當受影響的 endpoint 能夠成功產生,且空的預設值被視為 null 時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- openapi, python
- 領域
- backend-api-design, devtools
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100