fastapi-cache icon indicating copy to clipboard operation
fastapi-cache copied to clipboard

Use fastapi._compat's ModelField if pydantic version is 2

Open karthik17 opened this issue 2 years ago • 3 comments

Use fastapi._compat's ModelField if pydantic version is 2, as the ModelField in pydantic v1 is not there in v2 anymore.

karthik17 avatar Nov 13 '23 18:11 karthik17

I hope it will eventually be merged, because outdated pedantic makes whole library unusable (together with stupid limitation of caching only GET requests)

antonkulaga avatar Nov 16 '23 02:11 antonkulaga

Hey, how is this PR supposed to work?

I merged your changes locally, but I get an attribute error when fastapi-cache tries to initialize ModelField class due to non-existent attributes in the FastAPI compat class when it loads data from cache.

Any ideas would be helpful, I'm getting frustrated and will downgrade FastAPI to use Pydantic v1 just for this reason.

divadsn avatar Dec 28 '23 05:12 divadsn

@long2ice can we move forward with supporting pedantic > 2 ?

lb-ronyeh avatar Jul 15 '24 14:07 lb-ronyeh