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

[3.15] Add ValidationError params argument & default_params attribute #338

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion rest_framework-stubs/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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): ...
Expand Down
4 changes: 0 additions & 4 deletions scripts/stubtest/allowlist_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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