+def _format_validation_error(error):
+ """
+ :param error: validation error to format
+ :type error: jsonchema.exceptions.ValidationError
+ :returns: string representation of the validation error
+ :rtype: str
+ """
+ match = re.search("(.+) is a required property", error.message)
+ if match:
+ message = 'Error: missing required property {}.'.format(
+ match.group(1))
+ else:
+ message = 'Error: {}\n'.format(error.message)
+ if len(error.absolute_path) > 0:
+ message += 'Path: {}\n'.format(
+ '.'.join(
+ [six.text_type(path)
+ for path in error.absolute_path]))
+ message += 'Value: {}'.format(json.dumps(error.instance))
+
+ return message
+
+