Skip to content

Commit

Permalink
Handling if the context is just a string rather than a dict
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Oct 25, 2019
1 parent d95d437 commit e92d2d6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions schema/schemavalidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ def validate(data, version, url):
print('\n Path for error: {}'.format(printPath(err.path, err.message)))
context = err.instance
print (json.dumps(err.instance, indent=4))
for key in context:
print('****')
print(key)
print('****')
if isinstance(context[key], list):
context[key] = '[ ... ]'
elif isinstance(context[key], dict):
context[key] = '{ ... }'
if isinstance(context, dict):
for key in context:
print('****')
print(key)
print('****')
if isinstance(context[key], list):
context[key] = '[ ... ]'
elif isinstance(context[key], dict):
context[key] = '{ ... }'
errorsJson.append({
'title': 'Error {} of {}.\n Message: {}'.format(errorCount, len(errors), err.message),
'detail': detail,
Expand Down

0 comments on commit e92d2d6

Please sign in to comment.