openapi-generators / openapi-generators/openapi-python-client
Linting error when class has a property with the same name after snake case
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 2k
- 分支
- 293
- 平均合併
- 34 分鐘
- 30 天內合併 PR
- 1
描述
openapi-python-client: 0.21.4
Python: 3.10
OpenAPI spec version: 3.0.3
In OpenAPI specs where a property has the same name as the snake cased class name (in the example below, the snake casing is the lower case, but if it was, ex, InstagramId, then this would happen with a property named instagram_id) the code generated has a duplicated variable name (see image below).
The suggested fix is that the return variable name should have an underscore _, in this example, email_.
"Email": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"verified": {
"type": "boolean"
}
},
"required": [
"email",
"type"
]
},
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用 openapi-python-client 0.21.4,透過提供的 OpenAPI 3.0.3 程式片段重現此問題,並檢查產生的 Email 模型。追蹤選擇回傳變數和屬性名稱的產生器路徑,然後確認產生的名稱不再衝突,且範例仍然是有效的 Python 程式碼。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- openapi, python
- 領域
- devtools
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100