-
Notifications
You must be signed in to change notification settings - Fork 268
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 behavior for unions #1638
Conversation
CodSpeed Performance ReportMerging #1638 will not alter performanceComparing Summary
|
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.
This seems fine to me; the union is just a simple combination of inner validators, and really it is their configuration which matters.
src/url.rs
Outdated
@@ -400,7 +400,7 @@ impl PyMultiHostUrl { | |||
username: username.map(Into::into), | |||
password: password.map(Into::into), | |||
host: host.map(Into::into), | |||
port: port.map(Into::into), | |||
port, |
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.
linting fix due to new clippy version :)
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.
LGTM! Rebasing should fix the wasm build issue.
We currently don't allow the application of the
strict
constraint toUnion
types inpydantic
. We should defer to either the runtime strict specification or the union choice strict specification.strict
can either be specified at runtime via thestrict
flag tomodel_validate_X
, on a model's config, or on the union member type.This fixes pydantic/pydantic#10571 by reflecting that pattern in
pydantic-core
.