Skip to content
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: type-error on model_validator in wrap mode #7496

Merged
merged 2 commits into from Sep 19, 2023

Conversation

pmmmwh
Copy link
Contributor

@pmmmwh pmmmwh commented Sep 19, 2023

Change Summary

Since #7154, ModelWrapValidator is generic, and if reportUnknownVariableType is enabled in Pyright the import will be a type-error. I think it was an oversight to not add the type-parameter here as the other generic model validator type (ModelAfterValidator) consumes the type-parameter - and adding it indeed fixes the issue.

I think this doesn't need a new test as it's purely a type-level change.

Related issue number

Prior PR - #7154

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @davidhewitt

Since #7154, `ModelWrapValidator` is generic, and if `reportUnknownVariableType` is enabled in Pyright the import will be a type-error. I think it was an oversight to not add the type-parameter here as the other generic model validator type (`ModelAfterValidator`) consumes the type-parameter - and adding it indeed fixes the issue.
@pmmmwh
Copy link
Contributor Author

pmmmwh commented Sep 19, 2023

please review

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, thanks!

@davidhewitt davidhewitt merged commit f468466 into pydantic:main Sep 19, 2023
49 checks passed
@pmmmwh pmmmwh deleted the patch-1 branch September 20, 2023 13:31
@davidhewitt davidhewitt added the relnotes-fix Used for bugfixes. label Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants