-
Notifications
You must be signed in to change notification settings - Fork 240
Open
Description
#269 was fixed, but only for integer:
>>> v = cerberus.Validator({'foo': {'coerce': int, 'nullable': True, 'type': 'integer'}})
>>> v.normalized({'foo': None})
{'foo': None}
Just replace integer to string:
>>> v = cerberus.Validator({'foo': {'coerce': str, 'nullable': True, 'type': 'string'}})
>>> v.normalized({'foo': None})
Expected behavior: {'foo': None}
Actual behavior: {'foo': 'None'}
So I still have to use a workaround 'coerce': lambda x: str(x) if x is not None else None
But now I'm not sure if it's a bug or a feature (duplicate of #142?). If this is a feature, please describe this behavior in the documentation