From 7e89ae91d12009dee5508cc51c703df103b1d302 Mon Sep 17 00:00:00 2001 From: vmaillol-altair <55581329+vmaillol-altair@users.noreply.github.com> Date: Fri, 24 Jul 2020 15:56:49 +0200 Subject: [PATCH 1/2] Update validators.py Improve Error raised by In validator --- voluptuous/validators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/voluptuous/validators.py b/voluptuous/validators.py index 9b0e030..1d7706e 100644 --- a/voluptuous/validators.py +++ b/voluptuous/validators.py @@ -724,7 +724,8 @@ def __call__(self, v): except TypeError: check = True if check: - raise InInvalid(self.msg or 'value is not allowed') + raise InInvalid(self.msg or + 'value must be one of {}'.format(self.container)) return v def __repr__(self): From 0cf3d775a5b0695ff9d9a7c8364fe4dccee50718 Mon Sep 17 00:00:00 2001 From: vmaillol-altair <55581329+vmaillol-altair@users.noreply.github.com> Date: Tue, 13 Oct 2020 13:54:16 +0200 Subject: [PATCH 2/2] Update In and NotIn validator error message --- voluptuous/validators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/voluptuous/validators.py b/voluptuous/validators.py index 1d7706e..393de7e 100644 --- a/voluptuous/validators.py +++ b/voluptuous/validators.py @@ -745,7 +745,8 @@ def __call__(self, v): except TypeError: check = True if check: - raise NotInInvalid(self.msg or 'value is not allowed') + raise NotInInvalid(self.msg or + 'value must not be one of {}'.format(self.container)) return v def __repr__(self):