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

Null value handling #54

marcellarius opened this issue Aug 13, 2015 · 0 comments


Copy link

commented Aug 13, 2015

Null values in webargs are currently not handled very well.

  • None must not be passed to the type function.
    Python's builtin type functions don't handle None nicely (e.g. str(None) == 'None')
  • There needs to be a way to reject null values where they are not valid.
  • required=True currently accepts null values, which can be a bit surprising.

I think the simplest solution is to skip type conversion for None values and rely on
the existing validation feature to implement a not-null check. e.g.

Arg(str, required=True, validate=lambda x: x is not None)

The documentation for the 'required' parameter should make it clear that None values are not
considered missing.


marcellarius added a commit to marcellarius/webargs that referenced this issue Aug 17, 2015

Skip type conversion for None values
The built-in type conversion functions don't handle None values
usefully and make it difficult to accept "null" as a valid value
for an Arg.

By bypassing the type conversion, null values can be better controlled
with the use and validate parameters.

Issue: marshmallow-code#54

@sloria sloria closed this Aug 18, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.