You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating the OpenAPI schema, the enum StatusEnum in the User model shows incorrect values: it displays ["ACTIVE", "INACTIVE", "PENDING"] instead of the expected lowercase ["active", "inactive", "pending"].
I expected the OpenAPI documentation to match the Enum string values exactly as defined.
The response from the endpoint works correctly ("status": "ACTIVE"), but the docs show inconsistent casing.
Operating System
Windows
Operating System Details
No response
FastAPI Version
FastAPI Version: 0.121.3
Pydantic Version
Pydantic Version: 2.11.1
Python Version
Python Version: 3.11.11
Additional Context
I suspect this has to do with FastAPI or Pydantic's internal conversion of Enum names for OpenAPI generation, but I couldn’t find a way to preserve the original Enum values in the docs.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
When generating the OpenAPI schema, the enum StatusEnum in the User model shows incorrect values: it displays ["ACTIVE", "INACTIVE", "PENDING"] instead of the expected lowercase ["active", "inactive", "pending"].
I expected the OpenAPI documentation to match the Enum string values exactly as defined.
The response from the endpoint works correctly ("status": "ACTIVE"), but the docs show inconsistent casing.
Operating System
Windows
Operating System Details
No response
FastAPI Version
FastAPI Version: 0.121.3
Pydantic Version
Pydantic Version: 2.11.1
Python Version
Python Version: 3.11.11
Additional Context
I suspect this has to do with FastAPI or Pydantic's internal conversion of Enum names for OpenAPI generation, but I couldn’t find a way to preserve the original Enum values in the docs.
Beta Was this translation helpful? Give feedback.
All reactions