diff --git a/rest_framework-stubs/exceptions.pyi b/rest_framework-stubs/exceptions.pyi index 53a6d397f..a331e3715 100644 --- a/rest_framework-stubs/exceptions.pyi +++ b/rest_framework-stubs/exceptions.pyi @@ -1,5 +1,5 @@ from collections.abc import Mapping, Sequence -from typing import Any +from typing import Any, ClassVar from django.http import HttpRequest, JsonResponse from django_stubs_ext import StrOrPromise @@ -43,6 +43,10 @@ class APIException(Exception): class ValidationError(APIException): # ValidationError wraps `detail` in a list if it's not already a list/dict. detail: list[_Detail] | dict[str, _Detail] + default_params: ClassVar[Mapping[str, Any]] + def __init__( + self, detail: _Detail | None = ..., code: str | None = ..., params: Mapping[str, Any] | None = ... + ) -> None: ... class ParseError(APIException): ... class AuthenticationFailed(APIException): ... diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 19c8e6464..b3f0b7077 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -140,8 +140,6 @@ rest_framework.views.GenericView rest_framework.RemovedInDRF317Warning rest_framework.authtoken.migrations.0004_alter_tokenproxy_options rest_framework.compat.distinct -rest_framework.exceptions.ValidationError.__init__ -rest_framework.exceptions.ValidationError.default_params rest_framework.fields.DecimalField.__init__ rest_framework.fields.Field.__class_getitem__ rest_framework.fields.logger @@ -160,8 +158,6 @@ rest_framework.serializers.LIST_SERIALIZER_KWARGS_REMOVE rest_framework.serializers.ListSerializer.run_child_validation rest_framework.serializers.ModelSerializer.get_unique_together_constraints rest_framework.serializers.Serializer.set_value -rest_framework.serializers.ValidationError.__init__ -rest_framework.serializers.ValidationError.default_params rest_framework.templatetags.rest_framework.optional_logout rest_framework.utils.encoders.CustomScalar rest_framework.utils.field_mapping.get_unique_validators