-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix strict
application to function-after
with use_enum_values
#9279
Conversation
Please review @dmontagu |
Deploying pydantic-docs with Cloudflare Pages
|
CodSpeed Performance ReportMerging #9279 will not alter performanceComparing Summary
|
@@ -195,6 195,12 @@ def apply_known_metadata(annotation: Any, schema: CoreSchema) -> CoreSchema | No | |||
raise ValueError(f'Unknown constraint {constraint}') | |||
allowed_schemas = CONSTRAINTS_TO_ALLOWED_SCHEMAS[constraint] | |||
|
|||
# if it becomes necessary to handle more than one constraint | |||
# in this recursive case with function-after or function-wrap, we should refactor | |||
if schema_type in ['function-before', 'function-wrap', 'function-after'] and constraint == 'strict': |
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.
Better to use a set here, and possibly store it out of line. I’d be okay with just making it a set though
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.
As noted in #9279, there are a bunch of cases related to strict still not handled properly, that might be handled properly through a very similar change. But we can deal with them later.
Yep. Added said issue to the 2.8 milestone! |
Here's that issue: #9281 |
Fix #9257
Selected Reviewer: @samuelcolvin