canvas-medical / fhirstarter

An ASGI FHIR API framework built on top of FastAPI and FHIR Resources
MIT License
27 stars 12 forks source link

Pydantic 2.0 Migration Plan #258

Open vpwang opened 3 months ago

vpwang commented 3 months ago

Description The Pydantic version is limited to V1 in this package. However, the V2 version has added many useful features, such as customizable serializers. As both fhir.resources and FastAPI have supported Pydantic V2, will there be a plan for fhirstarter to upgrade to support the Pydantic V2?

What I Did pip install fhir.resources -U After starting the server, I got an error: ImportError: cannot import name 'display_errors' from 'pydantic.error_wrappers' (/usr/local/lib/python3.9/site-packages/pydantic/error_wrappers.py)

Related Package Versions pydantic 2.7.2 pydantic_core 2.18.3 fhir.resources 7.1.0 fhirstarter 2.4.0 fastapi 0.111.0 fastapi-cli 0.0.3

csande commented 3 months ago

Thank you for the request.

Off the top of my head, here is what I am aware of that would need to change:

There might be a few more, but that is what I'm aware of at the moment.

To answer your specific question, yes, FHIRStarter will support Pydantic 2.0 in the future, though I don't have a specific timeline at the moment.

csande commented 3 months ago

One more note on this -- I didn't know this, but apparently FHIR R4B is functionally equivalent to FHIR R4.

Given this, my feeling is that the best path forward for this would be to drop support for R4 to avoid having to conditionally support both.