Skip to content

Resolve "Opmet BE: Switch to Pydantic 2 and update FastAPI"

Belén Torrente requested to merge 148-pydantic2 into main

In this MR

Using Pydantic 2, as well as the latest FastAPI. Other package versions have been updated accordingly.

Main changes:

  • Some test data has been modified to comply with the validation.
  • Validators have been updated to be compliant with Pydantic 2
  • Treatment of dates has been unified to explicitly use the UTC timezone. Server-side default on the database have been removed to prevent issues with testing. The use of Fakedatetime has been replaced by freezegun to fix some of the date-related inconsistencies when testing, and at the same time make it more similar to the other backends.
  • URL handling through httpx.URL (previous use of urljoin was causing exceptions)
  • Validation of partially filled-in types (such as Draft) done through a new Partial model.

How to test

Inspect the code to make sure everything is OK. Follow the instructions in the README to run it locally against the FE (for example with docker compose -f docker-compose.yml -f docker-compose-admin.yml up -d --build), and make sure that no functionality has changed.

For KNMI: You can use this URL https://gw-avi-opmetbe-dev-148-tst.geoweb.dev.knmi.cloud (I will update it as I push the improvements suggested in the comments).

Closes #148 (closed)

Edited by Belén Torrente

Merge request reports

Loading