Create dict for the fields in the error response.

This commit is contained in:
Rebecca Law
2016-11-02 09:13:48 +00:00
parent e32978b72a
commit 36ac00811d
3 changed files with 12 additions and 6 deletions

View File

@@ -15,6 +15,8 @@ def build_error_message(errors, schema):
for e in errors:
field = "'{}' {}".format(e.path[0], e.schema.get('validationMessage')) if e.schema.get(
'validationMessage') else e.message
s = field.split("'")
field = {s[1]: s[2].strip()}
fields.append(field)
message = {
"code": "1001",