Enhance OpenAPI Generator Pydantic Models with typings
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 16
- Fork
- 3
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di zitadel/client-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
zitadel/client-python#125 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
zitadel/client-python#140 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
zitadel/client-python#99 ·
-
Release SDK for V5 Aperta
zitadel/client-python#80 · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
zitadel/client-python#78 ·
Tutte le issue di zitadel/client-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/skills#1811 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
speaches-ai/speaches#678 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
datalayer/mcp-compose#42 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
UKGovernmentBEIS/inspect_evals#2523 ·