auto-converting non-lists to list values.
This commit is contained in:
parent
8028382e79
commit
61b00b8b22
@ -25,6 +25,7 @@ def create_validation_error_response(ex:ValidationError, status_code:int=400)->t
|
|||||||
# the following conversion snipped ensures a dictionary output
|
# the following conversion snipped ensures a dictionary output
|
||||||
if isinstance(errors, (str,list)):
|
if isinstance(errors, (str,list)):
|
||||||
errors = {"undefined_schema":errors}
|
errors = {"undefined_schema":errors}
|
||||||
|
errors = {k:v if isinstance(v,list) else [v] for k,v in errors.items()}
|
||||||
|
|
||||||
# hence, errors always has the following type: dict[str, list[str]]
|
# hence, errors always has the following type: dict[str, list[str]]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user