Skip to content

Upgrade to pydantic v2 #520#521

Merged
joshdimanteto merged 16 commits intodevelopfrom
upgrade-to-pydantic-V2-#520
Mar 16, 2026
Merged

Upgrade to pydantic v2 #520#521
joshdimanteto merged 16 commits intodevelopfrom
upgrade-to-pydantic-V2-#520

Conversation

@joshdimanteto
Copy link
Copy Markdown
Contributor

@joshdimanteto joshdimanteto commented Jan 7, 2026

This PR will close #520

Description

  • Update pydantic to version 2
  • Change field_validator that are use repetitively to use annotated pattern

Testing Instructions

Add a set up instructions describing how the reviewer should test the code

  • Review code
  • Check GitHub Actions build
  • If icatdb Generator Script Consistency Test CI job fails, is this because of a deliberate change made to the script to change generated data (which isn't actually a problem) or is here an underlying issue with the changes made?
  • Review changes to test coverage
  • Does this change mean a new patch, minor or major version should be made? If so, does one of the commit messages feature fix:, feat: or BREAKING CHANGE: so a release is automatically made via GitHub Actions upon merge?
  • {more steps here}

Agile Board Tracking

Connect to #520

@joshdimanteto joshdimanteto force-pushed the upgrade-to-pydantic-V2-#520 branch from fa97c48 to b9fbab0 Compare January 8, 2026 16:43
@joshdimanteto joshdimanteto force-pushed the upgrade-to-pydantic-V2-#520 branch from 4548eb9 to f5a8fbf Compare January 8, 2026 17:29
@joshdimanteto joshdimanteto force-pushed the upgrade-to-pydantic-V2-#520 branch 3 times, most recently from 7284f0d to 9f8c259 Compare January 9, 2026 12:14
@joshdimanteto joshdimanteto force-pushed the upgrade-to-pydantic-V2-#520 branch from 9f8c259 to 06c6be2 Compare January 9, 2026 14:55
@joshdimanteto joshdimanteto marked this pull request as ready for review January 14, 2026 15:58
Copy link
Copy Markdown

@patrick-austin patrick-austin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a few thoughts on whether some of the pydantic functions are actually required or whether they can be simplified, but I've not actually run the code so some of my suggestions might be wrong (it's based on vague memory of how validation etc. works).

Will try and do some experimentation to check these suggestions make sense at some point, but it might be quicker for you to have a go if you have time?

Comment thread datagateway_api/src/common/config.py
Comment thread datagateway_api/src/common/config.py Outdated
Comment thread datagateway_api/src/search_api/models.py Outdated
Comment thread datagateway_api/src/search_api/models.py Outdated
Comment thread datagateway_api/src/search_api/models.py Outdated
Copy link
Copy Markdown

@patrick-austin patrick-austin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad those suggestions did actually work / make sense in the end. I haven't done any targeted manual testing (just checked that the API starts and I can submit an arbitrary query OK), since this didn't add/change any specific functionality and the tests are passing on the CI. I'm happy to approve based on that but let me know if you think there's something worth manually checking in more detail.

Base automatically changed from remove-database-backend-#489 to develop March 16, 2026 09:56
@joshdimanteto joshdimanteto merged commit 34af353 into develop Mar 16, 2026
8 checks passed
@joshdimanteto joshdimanteto deleted the upgrade-to-pydantic-V2-#520 branch March 16, 2026 09:57
@patrick-austin patrick-austin mentioned this pull request Apr 30, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants