databio / bedhost

API and UI for BEDbase
http://api.bedbase.org
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Updating examples to pydantic v2 #72

Closed nsheff closed 8 months ago

nsheff commented 1 year ago

with pydantic 2, fastapi seems to have a new way to define examples using JSONschema.

In bedhost, there's actually a lot of complexity to the code around examples, and validation. I propose we scrap all the old code, introduce a requirement of python 3.10 + pydantic v2, and refactor all the examples and validation code to follow the new approach.

khoroshevskyi commented 1 year ago

I think, we can't use pydantic v2 at this point because we are using sqlmodel, which is based on pydantic v1, and there will be conflicts

nsheff commented 1 year ago

hm. good point, we might need to wait until sqlmodel is compatible with pydantic v2. I think it should happen in the next few months.

nsheff commented 1 year ago

To track SQLmodel update to pydantic 2: https://github.com/tiangolo/sqlmodel/issues/532

nsheff commented 8 months ago

Models can be updated now because sqlmodel has been updated to pydantic v2.