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

ListField items_types parameter should be required #96

Open
avrahamshukron opened this issue Oct 9, 2017 · 0 comments
Open

ListField items_types parameter should be required #96

avrahamshukron opened this issue Oct 9, 2017 · 0 comments

Comments

@avrahamshukron
Copy link
Contributor

Right now this parameter has a None default value, which means that the actual value will be an empty tuple.

This creates inconsistent behavior:

class Foo(Base):
    l = ListField()  # Look ma, no `items_types`!

f = Foo()
f.l.append("a")  # works

# But look at this:
f = Foo(l=["a"])
Traceback (most recent call last):
 ...
ValidationError: Cannot decide which type to choose from "".

Inconsistency: Validation during __init__ is not the same as when using append.

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

1 participant