Type of "self.validators" is "list[((Any) -> None) | ContextValidator[Any]]"
This is the result of reveal_type(self.validators) on an instance of ModelSerializer. I don't see it explicitly defined in serializers.pyi so I am not sure where exactly it is coming from.
When evaluating the elements of the list against UniqueTogetherValidator mypy reports that the condition always returns False.
None of the Unique... validators are a type that is mentioned above so that is my assumption why that is.
How is that should be
The type for the validators property should include the Unique... validators (at least for ModelSerializer).
Bug report
What's wrong
The
Serializer.validators
property has the typeThis is the result of
reveal_type(self.validators)
on an instance ofModelSerializer
. I don't see it explicitly defined inserializers.pyi
so I am not sure where exactly it is coming from.When evaluating the elements of the list against
UniqueTogetherValidator
mypy reports that the condition always returnsFalse
.None of the Unique... validators are a type that is mentioned above so that is my assumption why that is.
How is that should be
The type for the
validators
property should include theUnique...
validators (at least forModelSerializer
).System information
python
version: 3.122django
version: 4.2.11mypy
version: 1.8.0django-stubs
version: 4.2.7