request: Support converter or json_validator with argument_type="body".

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-12-14 20:30:39 -05:00
committed by Tim Abbott
parent 970f22380a
commit 04d772b582
3 changed files with 49 additions and 31 deletions

View File

@@ -58,6 +58,10 @@ from zerver.lib.types import ProfileFieldData, Validator
ResultT = TypeVar("ResultT")
def check_anything(var_name: str, val: object) -> object:
return val
def check_string(var_name: str, val: object) -> str:
if not isinstance(val, str):
raise ValidationError(_("{var_name} is not a string").format(var_name=var_name))