[IMP] pydantic: moving from pydantic v1 to v2#551
Conversation
|
Hi @lmignon, |
c38ea04 to
f67615e
Compare
f67615e to
d592160
Compare
|
@petrus-v Thank you for the PR. IMO it's not a good idea to try to keep the compatibility with pydantic 1. I'm not in favour of maintaining this support into OCA addon. Pydantic V1 is no more supported with fastapi, extendable_fastapi and a restriction is declared into the manifest file for these addons. |
|
@lmignon thanks for your feedback. I'm fine to drop the support to pydantic v1, at least I did it to write some unit test in the module to make sure serialisation behave in the same way. As far I understand your are not using the pydantic module in your v17.0 projects so we can drop the compatibility ! Let's do it ! |
2f31fdf to
4c2a1a7
Compare
|
@lmignon et voilà : dropping support to pydantic v1 ! |
|
@alexandregaldeano, @Koudja I would love to get your review on this one ! |
|
This PR has the |
|
/ocabot merge minor |
|
On my way to merge this fine PR! |
|
@lmignon your merge command was aborted due to failed check(s), which you can inspect on this commit of 17.0-ocabot-merge-pr-551-by-lmignon-bump-minor. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
|
@lmignon I've pushed a new commit that freeze graphql_server dependency to make the CI check pass to help resuming the merge process |
e5d5eed to
d0e124b
Compare
6ed824e to
8ce9331
Compare
8ce9331 to
79aba45
Compare
damdam-s
left a comment
There was a problem hiding this comment.
works perfectly on custom project !
thanks !
|
/ocabot merge minor |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at ed98446. Thanks a lot for contributing to OCA. ❤️ |
Smothly migrate webservice from pydantic<2.0 using pydantic odoo module to pydantic>2.0 getting the same behaviour retrieves odoo data from Odoo records.
Using this PR to migrate your pydantic models you have to do something this:
pydantic < "2.0"your model looks like something like this:pydantic > "2.0"you should subclassPydanticOdooBaseModelwhich set the pydantic model config with the newfrom_attributes=True(aka old orm_mode). Your model will get same behaviour as the previous versions using theGenericOdooGetter: