Skip to content

Commit

Permalink
Add docs for unexpected_keyword_argument on dataclass (#7850)
Browse files Browse the repository at this point in the history
  • Loading branch information
laundmo committed Oct 17, 2023
1 parent a1c0bfb commit 188018c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/errors/validation_errors.md
Expand Up @@ -1833,6 +1833,25 @@ except ValidationError as exc:
#> 'unexpected_keyword_argument'
```

It is also raised when using pydantic.dataclasses and `extra=forbid`:

```py
from pydantic import TypeAdapter, ValidationError
from pydantic.dataclasses import dataclass


@dataclass(config={'extra': 'forbid'})
class Foo:
bar: int


try:
TypeAdapter(Foo).validate_python({'bar': 1, 'foobar': 2})
except ValidationError as exc:
print(repr(exc.errors()[0]['type']))
#> 'unexpected_keyword_argument'
```

## `unexpected_positional_argument`

This error is raised when you provide a positional value for a keyword-only
Expand Down

0 comments on commit 188018c

Please sign in to comment.