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

unallowed value None for nullable=True #393

Closed
1 of 2 tasks
lucas03 opened this issue May 17, 2018 · 2 comments
Closed
1 of 2 tasks

unallowed value None for nullable=True #393

lucas03 opened this issue May 17, 2018 · 2 comments

Comments

@lucas03
Copy link

lucas03 commented May 17, 2018

Used Cerberus version / latest commit: cerberus-1.2

  • I have the capacity to improve the docs when my problem is solved.
  • I have the capacity to submit a patch when a bug is identified.

Use-case abstract

Nullable is ignored

Support request / Bug report

In [1]: from cerberus import Validator

In [2]: client_schema = {'client': {
   ...:         'type': 'string',
   ...:         'nullable': True,
   ...:         'required': False,
   ...:         'allowed': ['browser', 'app', 'app_ios', 'app_android'],
   ...:     },
   ...: }

In [3]: client_body = {'client': None}

In [4]: v = Validator(client_schema)

In [5]: v.validate(client_body)
Out[5]: False

In [6]: v.errors
Out[6]: {'client': ['unallowed value None']}
@funkyfuture
Copy link
Member

well, but allowed isn't ignored and does its job. add None to its constraint and everything is good.

@lucas03
Copy link
Author

lucas03 commented May 17, 2018

:) thanks 👍

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