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

MultipleModelField and ListField don't allow empty lists #73

Open
taobojlen opened this issue Sep 23, 2022 · 1 comment
Open

MultipleModelField and ListField don't allow empty lists #73

taobojlen opened this issue Sep 23, 2022 · 1 comment

Comments

@taobojlen
Copy link
Contributor

We've been using this library for a few weeks and we're really liking it so far -- thank you!

There's one thing that keeps tripping us up: the MultipleModelField and ListFields (and maybe others) fail their validation if you pass an empty list. This is counterintuitive -- an empty list is still a list! You can work around it by setting required=False on the field, but then there's an ambiguity around whether the field is [] or None.

Would you be open to a PR that changed this behaviour such that empty lists are allowed?

@peterfarrell
Copy link
Contributor

It would likely break backwards compatibility if this behavior was changed. What about adding a new attribute called allow_empty which defaults to False (to maintain BC)?

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