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

Don't accept any iterable with many=True #930

Closed
tuukkamustonen opened this Issue Aug 30, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@tuukkamustonen
Contributor

tuukkamustonen commented Aug 30, 2018

With many=True, it probably doesn't make sense to accept any iterable (such as string or dict), simply because the user probably didn't intend to pass it.

Accepting any iterable (such as some "string") produces weird outcome with no good. It's better to fail fast and record error on invalid type.

So, maybe reject some specific iterables:

  • str
  • dict (is iterable, but would be weird and you cannot have dict as key anyway)

(Originating this from #622 PR, which suggested even more restrictive behavior.)

tuukkamustonen added a commit to tuukkamustonen/marshmallow that referenced this issue Aug 30, 2018

Fix marshmallow-code#930: Raise `ValidationError` on string with `man…
…y=True`

The actual fix actually came together in marshmallow-code#906, just adding tests and docs here.

tuukkamustonen added a commit to tuukkamustonen/marshmallow that referenced this issue Aug 30, 2018

Fix marshmallow-code#930: Raise `ValidationError` on string with `man…
…y=True`

The actual fix actually came together in marshmallow-code#906, just adding tests and docs here.

tuukkamustonen added a commit to tuukkamustonen/marshmallow that referenced this issue Sep 3, 2018

Fix marshmallow-code#930: Raise `ValidationError` on strings and mapp…
…ings with `many=True`

The actual fix actually came together in marshmallow-code#906, just expanding it to cover also
dicts, plus adding tests and docs here.

tuukkamustonen added a commit to tuukkamustonen/marshmallow that referenced this issue Sep 3, 2018

Fix marshmallow-code#930: Raise `ValidationError` on strings and mapp…
…ings with `many=True`

The actual fix actually came together in marshmallow-code#906, just expanding it to cover also
dicts, plus adding tests and docs here.

@sloria sloria closed this in f63a2ba Sep 18, 2018

sloria added a commit that referenced this issue Sep 18, 2018

Merge pull request #954 from marshmallow-code/906-non-iterables-with-…
…many

Fixes for #906 (TypeError with many=True) and #907 (return [] not {} on many=True error) and #930 (disallows strings and dicts on many=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment