diff --git a/openapi_python_client/schema/openapi_schema_pydantic/header.py b/openapi_python_client/schema/openapi_schema_pydantic/header.py index 3223c199b..2d2471ea9 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/header.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/header.py @@ -29,3 +29,10 @@ class Header(Parameter): ] }, ) + + +# Calling model_rebuild() here helps Pydantic to resolve the forward references that were used +# in defining Parameter and Encoding. Without this call, any subtle change to the loading order +# of schema submodules could result in an error like "Parameter is not fully defined". +# See: https://docs.pydantic.dev/latest/concepts/models/#rebuilding-model-schema +Parameter.model_rebuild()