Replies: 9 comments
-
+1 I am using //edit: interestingly, this issue disappeared when downgraded from python3.10 to python3.8. |
Beta Was this translation helpful? Give feedback.
-
@antoniodipinto I can no longer reproduce this on python 3.10 and FastAPI 0.79. Which versions are you using? |
Beta Was this translation helpful? Give feedback.
-
Hi @JarroVGIT, seems that I have this issue on Python version 3.8 and FastAPI 0.79 |
Beta Was this translation helpful? Give feedback.
-
Weird. I just tried it with python 3.8.13 and FastAPI 0.79, and still couldn't reproduce. I took the code example from the issue opening post and ran it. When requesting /openapi.json, I am seeing a normal JSON and not this. You sure you have the same issue? I know there are similar issues like this one (also with KeyError) when using dataclasses rather than BaseModels. See this issue #5138 |
Beta Was this translation helpful? Give feedback.
-
Update: everything is working fine right now. Probably some local python error. Reconfigured the venv and problem solved |
Beta Was this translation helpful? Give feedback.
-
Error Reason: First, Next, the openapi schema is generated using Finally, this ends up in a KeyError in What to do until this bug is fixed?
|
Beta Was this translation helpful? Give feedback.
-
Indeed, I was able to reproduce the problem by duplicating an identical BaseModel. In my case I experienced the error because I had two of these in my code :
My page http://127.0.0.1:5000/docs shows : Failed to load API definition. / Errors / Fetch error / Internal Server Error /openapi.json It seems sensitive to the versions, but I definitely got the issue with Pydantic 1.10.4, FastApi 0.92.0 Python 3.9.2 |
Beta Was this translation helpful? Give feedback.
-
First Check
Commit to Help
Example Code
Description
/openapi.json
Internal Server Error
when you should see the openapi.jsonOperating System
macOS
Operating System Details
No response
FastAPI Version
0.63.0
Python Version
3.9.7
Additional Context
Possibly related, but slightly different issues:
Also, removing the
str
inheritance in eitherType
orState
resolves the issue, though messes with the rest of our application logic.Beta Was this translation helpful? Give feedback.
All reactions