Enhance OpenAPI Generator Pydantic Models with typings
还没有人认领这个 Issue。
评估
调研方向
Start by locating the Jinja2 model template that generates the Pydantic classes, then inspect spec/sdk_test.py around the reported constructor usage. Compare explicit init generation with the alternative .pyi approach. Done means regenerated models accept snake_case arguments at runtime and MyPy passes without call-arg ignores.
由索引模型根据 Issue 内容生成。
描述
Title: Enhance OpenAPI Generator Pydantic Models with Explicit __init__ Signatures for Snake‑case Fields
What
Our generated Pydantic models only declare field aliases, not an explicit constructor signature, so MyPy reports errors when consuming code passes snake_case keyword arguments:
Minimal example
# Generated by OpenAPI Generator (no explicit __init__)
class V2SetHumanProfile(BaseModel):
given_name: Annotated[str, Field(alias="givenName")]
family_name: Annotated[str, Field(alias="familyName")]
# … other fields …
# In test or client code:
profile = V2SetHumanProfile(
given_name="John",
family_name="Doe",
)
spec/sdk_test.py:35: error: Unexpected keyword argument "given_name" for "V2SetHumanProfile"; did you mean "givenName"? [call-arg]
At runtime, Pydantic’s populate_by_name=True accepts given_name/family_name, but MyPy only “sees” the aliased fields and so flags the snake_case kwargs as invalid.
Why
- Improved DX & autocompletion
Developers expect Python‑style constructor arguments (given_name, notgivenName). - Stronger static guarantees
Eliminates the need for# type: ignore[call-arg]or hand‑written stubs. - Consistency
Keeps runtime behavior and static types in sync.
How
-
Inject explicit
__init__in the generator template
Update the Jinja2 model template to emit a constructor exposing snake_case names: -
(Alternative) Generate
.pyistubs
Produce companion stub files with explicit__init__signatures. -
Regenerate the SDK & validate
- Run the generator with the updated template.
- Confirm constructors accept snake_case args.
- Verify MyPy passes without ignores.
- 主要语言
- Python
- 星标
- 16
- 派生
- 3
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
zitadel/client-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
zitadel/client-python#125 ·
-
难度 3/5 1-2 天 新手友好度 72/100
zitadel/client-python#140 ·
-
难度 2/5 1-3 小时 新手友好度 52/100
zitadel/client-python#99 ·
-
zitadel/client-python#80 · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 45/100
zitadel/client-python#78 ·
查看 zitadel/client-python 的全部 Issue
相似的 Issue
-
essnmx good first issue
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 2/5 1-3 小时 新手友好度 65/100
syfoud/Simulated_Scepter#174 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Giskard-AI/giskard-oss#2840 · 1 条评论 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success 未关闭area: repo bug perceived difficulty: 2
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
yeti-platform/yeti#1380 ·