format of exceptions now always follows baseline format. 'errors'-key is always a list of dictionaries.

This commit is contained in:
Max Metz 2024-09-10 13:50:13 +02:00
parent 4f88e493d9
commit 7a97cd7d95

View File

@ -35,7 +35,8 @@ def create_validation_error_response(ex:ValidationError, status_code:int=400, cr
errors = {"undefined_schema":errors} errors = {"undefined_schema":errors}
errors = {k:v if isinstance(v,list) else [v] for k,v in errors.items()} 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: list[dict[str, list[str]]]
errors = [errors]
# example: # example: