Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
minenwerfer committed Aug 26, 2023
1 parent a65dda0 commit 519e05a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ We then decided to make this validation in-loco using a more vanilla approach wi

```python
import typing
from micromodel import model
from micromodel import model, ValidationOptions

Animal = typing.TypedDict('Animal', {
'name': str,
Expand All @@ -43,10 +43,10 @@ m = model(Person, {
# hooks can be implemented using monkeypatching
# setting default values also can be achieved this way
old_validate = m.validate
def new_validate(target: Person):
def new_validate(target: Person, options: ValidationOptions = {}):
new = target.copy()
new['name'] = new.get('name', 'unknown')
return validate(Person, typing.cast(typing.Any, new))
return old_validate(new, options)

m.validate = new_validate

Expand Down

0 comments on commit 519e05a

Please sign in to comment.