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