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
I used the GitHub search to find a similar issue and didn't find it.
I searched the FastAPI documentation, with the integrated search.
I already searched in Google "How to X in FastAPI" and didn't find any information.
I already read and followed all the tutorial in the docs and didn't find an answer.
I already checked if it is not related to FastAPI but to Pydantic.
I already checked if it is not related to FastAPI but to Swagger UI.
I already checked if it is not related to FastAPI but to ReDoc.
Commit to Help
I commit to help with one of those options 👆
Example Code
# any fastapi code is OKfromfastapiimportFastAPIapp=FastAPI()
@app.get("")asyncdefmain():
return"ok"
Description
Currently, the FastAPI's internal Pydantic models are not compatible with Pydantic V2.
For example,
dependencies/models.py
openapi/models.py
exceptions.py
As Pydantic V2 is implemented with Rust, it should be quite performant than V1. I suggest preparing for its V2 in advance so that FastAPI can take advantage of it.
Wanted Solution
We have to solve lots of errors. There are several categories:
Errors from parameter change, for example: Field(gte=0) becomes Field(ge=0)
Errors from Pydantic implementation change, you may see some recursion errors
Wanted Code
# user should not rewrite their FastAPI code, or at least there is little to rewritefromfastapiimportFastAPIapp=FastAPI()
@app.get("")asyncdefmain():
return"ok"
Alternatives
No response
Operating System
Linux, Windows, macOS, Other
Operating System Details
No response
FastAPI Version
0.88.0
Python Version
3.11.0
Additional Context
I'll give two typical errors here. When updated to Pydantic V2 and applied some parameter changes, if you
The migration to V2 I guess it's not gonna be the major thing cause FastAPI until now gonna be stable and working on providing a new version each time there is progress in making the framework more Fast.
so the point here is FastAPI will migrate to Pydantic 2 but not now still need time and also a bunch of surveys to see people who use the latest versions and do updates to their packages, while maybe it will touch the way how some projects have customized classes and models in pydantic, lets wait and see
First Check
Commit to Help
Example Code
Description
Currently, the FastAPI's internal Pydantic models are not compatible with Pydantic V2.
For example,
dependencies/models.py
openapi/models.py
exceptions.py
As Pydantic V2 is implemented with Rust, it should be quite performant than V1. I suggest preparing for its V2 in advance so that FastAPI can take advantage of it.
Wanted Solution
We have to solve lots of errors. There are several categories:
Field(gte=0)
becomesField(ge=0)
Wanted Code
Alternatives
No response
Operating System
Linux, Windows, macOS, Other
Operating System Details
No response
FastAPI Version
0.88.0
Python Version
3.11.0
Additional Context
I'll give two typical errors here. When updated to Pydantic V2 and applied some parameter changes, if you
The text was updated successfully, but these errors were encountered: