Fix serialization schema generation when using PlainValidator#10427
Merged
sydney-runkle merged 3 commits intomainfrom Sep 17, 2024
Merged
Fix serialization schema generation when using PlainValidator#10427sydney-runkle merged 3 commits intomainfrom
PlainValidator#10427sydney-runkle merged 3 commits intomainfrom
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
|
Contributor
| core_schema.wrap_serializer_function_ser_schema( | ||
| function=lambda v, h: h(v), | ||
| schema=schema, | ||
| return_schema=schema, |
Contributor
There was a problem hiding this comment.
Do we not need to do handler.generate_schema(source_type) here?
Member
Author
There was a problem hiding this comment.
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.
sydney-runkle
approved these changes
Sep 17, 2024
Contributor
sydney-runkle
left a comment
There was a problem hiding this comment.
Wonderful, thanks @Viicos!!
Open
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
xfailtest linking to this issue?Related issue number
Fixes #10385
Fixes #8586
Checklist