-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/mx 1380 update pydantic to v2 (#24)
This PR adresses the mex-common part of [Ticket 1380](https://jira.rki.local/browse/MX-1380). Incomplete summary of relevant pydantic changes: - `pydantic_model.dict()` becomes `pydantic_model.model_dump()` - `pydantic_model.parse_obj()` becomes `pydantic_model.model_validate()` - `pydantic_model.construct()` becomes `pydantic_model.model_construct()` - `pydantic_model.Config` becomes `pydantic_model.model_config`, which is of type pydantic.ConfigDict - optional fields must now have a default value, e.g. `attribute: str | None = None` - settings field attribute `env` becomes `validation_alias` or `serialization_alias`, depending on the direction (serialization or validation) - for a more complete overview, see the [pydantic migration guide](https://docs.pydantic.dev/dev-v2/migration/) This PR: - bumps pydantic to v2.4.2 - adds the mypy plugin for pydantic Open Questions: - pytest captures warnings in `tests/backend_api/test_connector.py::test_post_models_mocked`and `tests/public_api/test_connector.py::test_post_models_mocked`: ``` C:\Users\SchiebenhoeferH\projects\mex-common\.venv\Lib\site-packages\pydantic\main.py:308: UserWarning: Pydantic serializer warnings: Expected `list[str]` but got `Email` - serialized value may not be as expected Expected `list[str]` but got `str` - serialized value may not be as expected Expected `list[str]` but got `str` - serialized value may not be as expected return self.__pydantic_serializer__.to_python( ``` I guess these are due to our listyness fix. The only fix I can think of is to convert attributes to their expected type during serialization which seems a bit excessive. What do you think? --------- Signed-off-by: rababerladuseladim <[email protected]> Co-authored-by: Nicolas Drebenstedt <[email protected]>
- Loading branch information
1 parent
cd31a22
commit 97a1ef1
Showing
66 changed files
with
1,090 additions
and
659 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.