spraakbanken / karp-backend

Karp backend
MIT License
3 stars 2 forks source link

Upgrade pydantic, FastAPI and uvicorn #274

Closed majsan closed 3 months ago

majsan commented 4 months ago

Latest versions did not work out of the box.

Latest uvicorn worked locally, but not on server, which might be due to the server using --root-path.

nick8325 commented 4 months ago

Pydantic has quite a lot of breaking changes which might be why it didn't work, see https://docs.pydantic.dev/latest/migration/. For example some methods changed name and the way to configure the model config changed.

nick8325 commented 3 months ago

I've upgraded FastAPI and pydantic now

majsan commented 3 months ago

@nick8325 Generating the documentation does not work now due to errors in unique_id.py:

  File "/home/maria/språkbanken/karp/karp-backend/karp/foundation/value_objects/unique_id.py", line 13, in __get_pydantic_json_schema__
    json_schema = handler(core_schema.str_schema())
                          ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'str_schema

I am trying to fix it, but maybe you have a better idea what's wrong.

nick8325 commented 3 months ago

Think I just wrote something stupid :) I can try and fix it.

nick8325 commented 3 months ago

Done! I think it was a search and replace that went wrong.

nick8325 commented 3 months ago

(re-opening because there is still uvicorn to be done, right?)

majsan commented 3 months ago

I opened a new one #276, so we can close this.