openapi-generators / openapi-generators/openapi-python-client
Minor schema validation error: doesn't complain about invalid default for null and file types
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 2k
- 分支
- 293
- 平均合併
- 34 分鐘
- 30 天內合併 PR
- 1
描述
Describe the bug
NoneProperty.build and FileProperty.build do have logic to detect if a default other than None was provided for a null property, or if any default was provided for a binary string—and we do have unit tests for those. However, in reality NoneProperty.build and FileProperty.build do not actually get called, because property_from_data just calls the initializers directly instead. Therefore if you do something like this, the default is simply ignored.
OpenAPI Spec File
components:
schemas:
MyModel:
properties:
myNullProperty:
type: "null"
default: "definitely not null"
myBinaryString:
type: string
format: binary
default: "???"
Desktop (please complete the following information):
- OS: any
- Python Version: any
- openapi-python-client version: 0.21.6
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先追蹤 property_from_data,並將其對 initializer 的直接呼叫與 NoneProperty.build 和 FileProperty.build 進行比較,後者已包含驗證邏輯。執行這些 builder 現有的單元測試,然後新增測試涵蓋範圍,以顯示所提供 OpenAPI schema 中的無效預設值會被拒絕,而不是被忽略。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- api, tooling
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 58/100