From ba519decd511637c315ad16dd49edcc46a9b9b7c Mon Sep 17 00:00:00 2001 From: Alexandr Dzhurinskij Date: Wed, 23 Oct 2019 00:49:10 +0300 Subject: [PATCH] Skip choices for nullable argument in RequestParser --- flask_restplus/reqparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_restplus/reqparse.py b/flask_restplus/reqparse.py index d24b4d38..17bdcff6 100644 --- a/flask_restplus/reqparse.py +++ b/flask_restplus/reqparse.py @@ -232,7 +232,7 @@ def parse(self, request, bundle_errors=False): continue return self.handle_validation_error(error, bundle_errors) - if self.choices and value not in self.choices: + if self.nullable is False and self.choices and value not in self.choices: msg = 'The value \'{0}\' is not a valid choice for \'{1}\'.'.format(value, name) return self.handle_validation_error(msg, bundle_errors)