python-betterproto icon indicating copy to clipboard operation
python-betterproto copied to clipboard

pydantic v2 support

Open DeoLeung opened this issue 2 years ago • 3 comments
trafficstars

Hi,

Thanks for the great job. I'm just wondering whether pydantic v2 support is on the way, seems using root_validator is raising error in v2.

like langchain use a submodule import .

DeoLeung avatar Sep 22 '23 01:09 DeoLeung

One of the commits in #531 limits Pydantic to v1 to fix this issue. I noticed that popping up more consistently during tests with the Tox fix - not entirely sure why it wasn't being flagged before.

JoshuaLeivers avatar Oct 12 '23 09:10 JoshuaLeivers

Hi all, is there any update on this? I would love to use betterproto, but I can not switch back to pydantic v1.

Thanks

bigluck avatar Jun 01 '24 14:06 bigluck

Maybe I'm wrong but I don't think limiting pydantic to an outdated version is an ideal solution to this issue. Is this the only problem with using pydantic > 2? The error message I get indicates that you just need to specify skip_on_failure=True in the root_validator decorator (which should be replaced with model_validator either way). Would you accept a PR that makes that change?

jafaircl avatar Jun 05 '24 21:06 jafaircl