Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: DeprecationWarning due to use of general_plain_validator_function in MSONable.__get_pydantic_core_schema__ with Pydantic v2 #598

Open
ugognw opened this issue Nov 24, 2023 · 2 comments

Comments

@ugognw
Copy link

ugognw commented Nov 24, 2023

monty/monty/json.py

Lines 291 to 300 in 5d37679

def __get_pydantic_core_schema__(cls, source_type, handler):
"""
pydantic v2 core schema definition
"""
if core_schema is None:
raise RuntimeError("Pydantic >= 2.0 is required for validation")
s = core_schema.general_plain_validator_function(cls.validate_monty_v2)
return core_schema.json_or_python_schema(json_schema=s, python_schema=s)

Pydantic suggests a straight swap for core_schema.with_info_plain_validator_function

@janosh
Copy link
Contributor

janosh commented Nov 24, 2023

@shyuep Did you mean to assign @munrojm?

@janosh janosh removed their assignment Nov 24, 2023
@ugognw ugognw changed the title [Bug]: DeprecationWarning due to use of general_plain_validator_function in MSONable.__get_pydantic_core_schema__ [Bug]: DeprecationWarning due to use of general_plain_validator_function in MSONable.__get_pydantic_core_schema__ with Pydantic v2 Dec 7, 2023
@DanielYang59
Copy link
Contributor

Thanks! Fixed in #631.

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

No branches or pull requests

3 participants