`Input should be a valid string` for integer keys in openapi.yaml
还没有人认领这个 Issue。
评估
调研方向
首先使用关联的 openapi.yaml 和 openapi-python-client 0.26.2 重现该故障,重点关注 paths./api/events.get.responses.200 中的 response key。当 integer keys 在类生成期间被接受并作为 strings 处理,而不是产生 Pydantic validation error 时,工作即完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
When generating classes from openapi.yaml with integers as keys (e.g. 200), I get the error:
paths./api/events.get.responses.200.[key]
Input should be a valid string [type=string_type, input_value=200, input_type=int]
For further information visit https://errors.pydantic.dev/2.12/v/string_type
Is there a chance to ignore those errors and fall back to string for integer keys?
OpenAPI Spec File
Link to an OpenAPI document
Desktop (please complete the following information):
- OS: macOS 26.0.1
- Python Version: 13.3
- openapi-python-client version: 0.26.2
- 主要语言
- Python
- 星标
- 2k
- 派生
- 293
- 平均合并
- 34 分钟
- 30 天内合并 PR
- 1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openapi-generators/openapi-python-client 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 3/5 1-2 天 新手友好度 72/100
openapi-generators/openapi-python-client#1451 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 52/100
-
难度 3/5 1-2 天 新手友好度 64/100
openapi-generators/openapi-python-client#1435 · 1 条评论 ·
查看 openapi-generators/openapi-python-client 的全部 Issue
相似的 Issue
-
fix: inaccuracy ⚠️
难度 2/5 1-3 小时 新手友好度 72/100
uabrc/uabrc.github.io#1255 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
ethereum-optimism/factory#64 ·
-
难度 2/5 1-3 小时 新手友好度 90/100
duckdb/duckdb-python#627 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
documentation
难度 1/5 1 小时以内 新手友好度 78/100
Qiskit/qiskit-addon-sqd#376 ·