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 ValidationError false positive on nested inputs #943

Merged

Conversation

intgr
Copy link
Collaborator

@intgr intgr commented Apr 28, 2022

I have made things!

Regression from PR #909.

As previously discussed in #767 (comment), ValidationError accepts arbitrarily nested data structures as the message argument. Mypy does not currently support recursive type aliases, so AFAIK it's impossible to accurately describe the correct type of this. In any case, the current hints are not correct.

For example this correct code from django-rest-framework produces a false positive error: https://github.com/encode/django-rest-framework/blob/3.13.1/tests/test_fields.py#L2428-L2433

I don't have any better ideas other than to revert to my version from #767 that uses Any.

@sobolevn sobolevn merged commit c836c3a into typeddjango:master Apr 28, 2022
@sobolevn
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants