-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 serialization schema generation when using PlainValidator
#10427
Conversation
Do not hardcode a new wrap serializer schema if a serialization schema was already generated before.
Deploying pydantic-docs with
|
Latest commit: |
1fb016f
|
Status: | ✅ Deploy successful! |
Preview URL: | https://956db31c.pydantic-docs.pages.dev |
Branch Preview URL: | https://10385.pydantic-docs.pages.dev |
CodSpeed Performance ReportMerging #10427 will not alter performanceComparing Summary
|
pydantic/functional_validators.py
Outdated
core_schema.wrap_serializer_function_ser_schema( | ||
function=lambda v, h: h(v), | ||
schema=schema, | ||
return_schema=schema, |
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 not need to do handler.generate_schema(source_type)
here?
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.
Hum I don't think it will change anything in this case as schema
is guaranteed to not have any serialization key here, but I'll change to align with how it is done in Plain/WrapSerializer
.
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.
Wonderful, thanks @Viicos!!
Do not hardcode a new wrap serializer schema if a serialization schema was already generated before.
Note that the following can be used as a failing MRE, related to the TODO comment:
Maybe we should create a new issue, and add a
xfail
test linking to this issue?Related issue number
Fixes #10385
Fixes #8586
Checklist