Skip to content

Commit

Permalink
added README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
enes.aksu committed Jan 1, 2020
1 parent 6938de6 commit afdca50
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# dataclass_plus

The `dataclass_plus` is a fastest type validation library for the `dataclass`


## Example


```python
from dataclass_plus import dataclass_plus
from typing import List, Dict, Tuple


@dataclass_plus
class Model:
id: int
name: str
dict_example: Dict[str, str]
list_example: List[int] # this field is required
tuple_example: Tuple[str, float] = None # this field is not required because set default None


Model(
id=1,
name='Test Test',
dict_example={"test": "test"},
list_example=[1,2],
tuple_example=("test", 1.2)
)
# => Model(id=1, name='Test Test', dict_example={"test": "test"}, list_example=[1,2], tuple_example=("test", 1.2))
# Invalid Model
Model(
id=1,
name='Test Test',
dict_example={"test": 1},
list_example=[1,2],
tuple_example=("test", 1.2)
)
# => ValueError: {'test': 1} is not typing.Dict[str, str]
```

0 comments on commit afdca50

Please sign in to comment.