add relative location to CT schema errors

This commit is contained in:
AlanCoding 2018-04-19 14:58:40 -04:00
parent 60e3dfe22c
commit fb43538333
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

View File

@ -420,6 +420,10 @@ class JSONSchemaField(JSONBField):
'{type} provided, expected {expected_type}'
).format(path=list(error.path), type=type(error.instance).__name__,
expected_type=expected_type)
elif error.validator == 'additionalProperties' and hasattr(error, 'path'):
error.message = _(
'Schema validation error in relative path {path} ({error})'
).format(path=list(error.path), error=error.message)
errors.append(error)
if errors: