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
Type errors with @model_validator #8529
Comments
Thanks for bringing this to our attention. We're looking into this issue and a potential fix 👍. |
So, we have set up the At any rate, you should be able to eliminate this type error in your own code by setting the return type as That said, it doesn't necessarily seem to me like we should put a restriction on the return type of a If using And if we have examples like this in the docs it definitely makes sense to change the docs. |
Sidenote: The type error for |
It works correctly (pyright no longer reports an error).
Yes, the model_validator documentations uses |
@noctuid and @not-my-profile, I just updated the docs with fixes for these type annotations. Thanks for bringing this to our attention :). |
The fix for #7152 was merged in v2.2.2 but apparently there has been a regression because with pydantic 2.5.3 pyright again reports a type error. It should be noted that this doesn't only happen for
mode="wrap"
.The same type error can also be observed with
mode="before"
andmode="after"
, for example the code from the documentation:results in the type errors:
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: