-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Description
Used Cerberus version / latest commit: 1.1
-
I consulted these documentations:
-
I consulted these sections of the docs (add more lines as necessary):
-
I found nothing relevant to my problem in the docs.
-
I found the documentation not helpful to my problem.
-
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
A dependency is not considered satisfied if it has a null value.
Support request / Bug report
To reproduce:
>>> from cerberus import Validator
... validator = Validator(schema={
... 'field1': {
... 'required': False,
... 'nullable': True
... },
... 'field2': {
... 'required': False,
... 'dependencies': 'field1'
... }
... })
... document = {
... 'field1': None,
... 'field2': 'foo'
... }
... assert validator.validate(document), validator.errors
Traceback (most recent call last):
File "<input>", line 16, in <module>
AssertionError: {'field2': ["field 'field1' is required"]}This seems wrong considering required fields with a null value satisfy the required constraint, but not a dependency.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels