Skip to content

Commit 68acc3d

Browse files
committed
fix(models): make model_rebuild backwards-compatible with pydantic v1
1 parent 8a6f1d4 commit 68acc3d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/openapi_client/models.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,4 +346,7 @@ class OpenAPI(OpenAPIBase):
346346
# Rebuild models due to forward references
347347
for model in list(locals().values()):
348348
if isinstance(model, type) and issubclass(model, BaseModel) and model != BaseModel:
349-
model.model_rebuild()
349+
if hasattr(model, "model_rebuild"):
350+
model.model_rebuild()
351+
elif hasattr(model, "update_forward_refs"):
352+
model.update_forward_refs()

0 commit comments

Comments
 (0)