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
Support __get_validators__ #7197
Conversation
validators = getattr(obj, '__get_validators__', None) | ||
if validators is None: | ||
return None | ||
schema = core_schema.chain_schema([core_schema.general_plain_validator_function(v) for v in validators()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know whether general_plain_validator_function
is the right choice
Deploying with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add a deprecation warning, otherwise LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we care how this interacts with Annotated
, including with other classes that implement __get_pydantic_core_schema__
? Might be worth testing
285f7ae
to
2cb4e9c
Compare
@adriangb, I think we already have a test for this. Is that enough? pydantic/tests/test_deprecated.py Lines 498 to 523 in d110b47
|
But that doesn't use this new / old |
Closes #6899