Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dicts without full type annotations error on parse #203

Open
illeatmyhat opened this issue Apr 2, 2020 · 1 comment
Open

Dicts without full type annotations error on parse #203

illeatmyhat opened this issue Apr 2, 2020 · 1 comment

Comments

@illeatmyhat
Copy link

@dataclass_json
@dataclass
class Foo:
    foo: Dict

Foo.from_json(Foo.to_json())

results in an error at from_json.
This is caused by missing type annotations, where Dict should be Dict[Any, Any]--though for parsing purposes it is more likely to end up being Dict[str,str]

In any case, the error produced in this case is very unfriendly and probably an easy mistake to make.

@lidatong
Copy link
Owner

hi, i agree this is probably a confusing error, see #206 and #207 for efforts at better errors!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants