openapi-generators / openapi-generators/openapi-python-client
overriding model property with more specific object type doesn't work
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 2k
- 分支
- 293
- 平均合併
- 34 分鐘
- 30 天內合併 PR
- 1
描述
Describe the bug
When an object schema derives from another object schema using allOf, and redeclares a property that had an object type to use a different object type, the generated code uses the old type for that property.
OpenAPI Spec File
https://gist.github.com/eli-bl/d5658d6714e1c9ef544ef1fc8902960a
With this example, the type of SpecialTask.result in the generated code should be SpecialTaskOutputData. Instead it is being declared as BaseTaskResult, the same as BaseTask.result.
Desktop (please complete the following information):
- OS: macOS 14.5
- Python Version: 3.8.15
- openapi-python-client version: 0.21.5
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先使用報告中連結的 OpenAPI 規格重現問題,並檢查為 BaseTask 和 SpecialTask 產生的模型。追蹤繼承的和重新宣告的物件屬性如何解析;當 SpecialTask.result 以 SpecialTaskOutputData 型別而不是 BaseTaskResult 產生時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- openapi, python
- 領域
- api, tooling
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100