bravado-core icon indicating copy to clipboard operation
bravado-core copied to clipboard

User-defined formatter validate functions have to handle None.

Open dpopowich opened this issue 9 years ago • 1 comments

When defining custom formatters with SwaggerFormat, the validate function has to handle None values. So all my validators are littered with code like this:

def my_validator(val):
   if val is not None:
      # real validation here

Shouldn't None be special-cased, left to x-nullable checking, never calling the validator when value==None is True? This is quite tedious.

dpopowich avatar Nov 30 '16 16:11 dpopowich

+1 Might be related to my PR #143

adamhadani avatar Jan 19 '17 16:01 adamhadani