Skip to content

Commit 6ea7ff3

Browse files
committed
make parameter explicit
1 parent 6badcc2 commit 6ea7ff3

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/validataclass/dataclasses/validataclass.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def validataclass(cls: None = None, /, **kwargs: Any) -> Callable[[type[_T]], ty
4343
def validataclass(
4444
cls: type[_T] | None = None,
4545
/,
46+
reject_unknown_fields: bool | None = None,
4647
**kwargs: Any,
4748
) -> type[_T] | Callable[[type[_T]], type[_T]]:
4849
"""
@@ -105,9 +106,6 @@ class StrictDataclass:
105106
"""
106107

107108
def decorator(_cls: type[_T]) -> type[_T]:
108-
# Pop validataclass-specific options before passing kwargs to @dataclass
109-
reject_unknown_fields = kwargs.pop('reject_unknown_fields', None)
110-
111109
# Set kw_only=True as the default to allow required and optional fields in any order
112110
kwargs.setdefault('kw_only', True)
113111

src/validataclass/validators/dataclass_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def __init__(
174174
required_fields=required_fields,
175175
default_validator=default_validator,
176176
)
177-
177+
178178
@staticmethod
179179
def _get_field_validator(field: dataclasses.Field[Any]) -> Validator[Any]:
180180
# Parse field metadata to get Validator

0 commit comments

Comments
 (0)