Do not implicitly convert after model validators to class methods#11957
Merged
Do not implicitly convert after model validators to class methods#11957
Conversation
5 tasks
b2ee66f to
7620df4
Compare
CodSpeed Performance ReportMerging #11957 will not alter performanceComparing Summary
|
Contributor
DouweM
approved these changes
Jun 12, 2025
DouweM
reviewed
Jun 12, 2025
1 task
psychedelicious
added a commit
to invoke-ai/InvokeAI
that referenced
this pull request
Oct 8, 2025
Fixes a test failure introduced by pydantic/pydantic#11957 TL;DR: "after" model validators should be instance methods, not class methods. Batch model updated to use an instance method, which fixes the failing test.
psychedelicious
added a commit
to invoke-ai/InvokeAI
that referenced
this pull request
Oct 8, 2025
Fixes a test failure introduced by pydantic/pydantic#11957 TL;DR: "after" model validators should be instance methods, not class methods. Batch model updated to use an instance method, which fixes the failing test.
2 tasks
antazoey
reviewed
Oct 9, 2025
antazoey
left a comment
There was a problem hiding this comment.
The test is misleading with its use of cls instead of self for "after" mode
| @model_validator(mode='after') | ||
| # This used to be converted into a classmethod, resulting | ||
| # in this inconsistent signature still accepted: | ||
| def validator(cls, model, info): ... |
There was a problem hiding this comment.
Shouldn't this be self instead of cls in this case?
Member
Author
There was a problem hiding this comment.
This is wrapped in a pytest.raises() context manager, and was meant to test that this particular invalid signature is now rejected.
el-dge
added a commit
to el-dge/fastapi-mail
that referenced
this pull request
Oct 9, 2025
This was referenced Oct 9, 2025
Closed
|
When will be new release? |
5 tasks
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.
Change Summary
Fixes #11905, closes #11906.
Technically this is a breaking change since the signature from the added test was unexpectedly working, but this wasn't documented at all and the fix is straightforward. What do you think?
Need to document the change (see #12110) in blog post and changelog.
Related issue number
Checklist