The Fix
pip install fastapi==0.128.4
Based on closed fastapi/fastapi issue #14431 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -180,8 +180,13 @@ def get_schema_from_model_field(
separate_input_output_schemas: bool = True,
) -> Dict[str, Any]:
+ computed_fields = field._type_adapter.core_schema.get("schema", {}).get(
+ "computed_fields", []
+ )
import pytest
from fastapi import FastAPI
from starlette.testclient import TestClient
@pytest.fixture(name="client")
def get_client():
app = FastAPI(separate_input_output_schemas=False)
from pydantic import BaseModel, computed_field
class Rectangle(BaseModel):
width: int
length: int
@computed_field
@property
def area(self) -> int:
return self.width * self.length
@app.get("/")
def read_root() -> Rectangle:
return Rectangle(width=3, length=4)
client = TestClient(app)
return client
def test_get(client: TestClient):
response = client.get("/openapi.json")
data = response.json()
rectangle_model = data["components"]["schemas"]["Rectangle"]["properties"]
assert "area" in rectangle_model.keys()
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install fastapi==0.128.4\nWhen NOT to use: This fix should not be used if computed fields are not intended to be included in the OpenAPI schema.\n\n
Why This Fix Works in Production
- Trigger: FastAPI app with `separate_input_output_schemas` disabled excludes computed fields on Pydantic models from OpenAPI output
- Mechanism: Computed fields were omitted from the OpenAPI schema when `separate_input_output_schemas` was set to False
- Why the fix works: Fix OpenAPI schema support for computed fields when using `separate_input_output_schemas=False`. (first fixed release: 0.128.4).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Computed fields were omitted from the OpenAPI schema when `separate_input_output_schemas` was set to False
- Production symptom (often without a traceback): FastAPI app with `separate_input_output_schemas` disabled excludes computed fields on Pydantic models from OpenAPI output
Proof / Evidence
- GitHub issue: #14431
- Fix PR: https://github.com/fastapi/fastapi/pull/13207
- First fixed release: 0.128.4
- Reproduced locally: No (not executed)
- Last verified: 2026-02-08
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.49
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Fixed by https://github.com/fastapi/fastapi/pull/13207 Available in FastAPI 0.123.4, released in the next few hours.”
Failure Signature (Search String)
- FastAPI app with `separate_input_output_schemas` disabled excludes computed fields on Pydantic models from OpenAPI output
- app = FastAPI(separate_input_output_schemas=False)
Copy-friendly signature
Failure Signature
-----------------
FastAPI app with `separate_input_output_schemas` disabled excludes computed fields on Pydantic models from OpenAPI output
app = FastAPI(separate_input_output_schemas=False)
Error Message
Signature-only (no traceback captured)
Error Message
-------------
FastAPI app with `separate_input_output_schemas` disabled excludes computed fields on Pydantic models from OpenAPI output
app = FastAPI(separate_input_output_schemas=False)
Minimal Reproduction
import pytest
from fastapi import FastAPI
from starlette.testclient import TestClient
@pytest.fixture(name="client")
def get_client():
app = FastAPI(separate_input_output_schemas=False)
from pydantic import BaseModel, computed_field
class Rectangle(BaseModel):
width: int
length: int
@computed_field
@property
def area(self) -> int:
return self.width * self.length
@app.get("/")
def read_root() -> Rectangle:
return Rectangle(width=3, length=4)
client = TestClient(app)
return client
def test_get(client: TestClient):
response = client.get("/openapi.json")
data = response.json()
rectangle_model = data["components"]["schemas"]["Rectangle"]["properties"]
assert "area" in rectangle_model.keys()
What Broke
OpenAPI output did not include computed fields, leading to incomplete API documentation.
Why It Broke
Computed fields were omitted from the OpenAPI schema when `separate_input_output_schemas` was set to False
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install fastapi==0.128.4
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/fastapi/fastapi/pull/13207
First fixed release: 0.128.4
Last verified: 2026-02-08. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if computed fields are not intended to be included in the OpenAPI schema.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.128.4 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.