konradhalas / dacite

Simple creation of data classes from dictionaries.
MIT License
1.76k stars 106 forks source link

List from_dict accepts all type of items #60

Closed winterjung closed 4 years ago

winterjung commented 5 years ago
from dataclasses import dataclass
from typing import List

import dacite

@dataclass
class A:
    a: List[int]

assert dacite.from_dict(A, {'a': ['1']})

dacite doesn't raise WrongTypeError even if we provide different type into A.a. I know that dacite is not designed to perform data validation, so just wondering it's intended behavior. 😄

konradhalas commented 4 years ago

Hi @JungWinter - thank you very much for reporting this issue.

You have right, it's a bug. It should be fixed now in master branch (via https://github.com/konradhalas/dacite/commit/9a3270d4a8e664b457fff38eb8495ff668f6c7aa).

I will release fixed version soon.