Merge pull request #1435 from AlanCoding/dragon_riddle

Add relative location to CT schema errors
This commit is contained in:
Alan Rominger 2018-04-19 16:01:18 -04:00 committed by GitHub
commit 81234986b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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: