def _validate_record(obj, eng): try: validate(obj.data, schema) except ValidationError: obj.extra_data['validation_errors'] = \ get_validation_errors(obj.data, schema) obj.extra_data['callback_url'] = \ get_resolve_validation_callback_url() obj.save() db.session.commit() reraise(*sys.exc_info())
def _validate_workflow_schema(workflow_data): """Validate the ``metadata`` against the ``hep`` JSONSchema. Args: workflow_data (dist): the workflow dict. Raises: CallbackValidationError: if the workflow ``metadata`` is not valid against ``hep`` JSONSchema. """ # Check for validation errors try: validate(workflow_data['metadata']) except ValidationError: workflow_data['_extra_data']['validation_errors'] = \ get_validation_errors(workflow_data['metadata'], 'hep') workflow_data['_extra_data']['callback_url'] = \ get_resolve_validation_callback_url() raise CallbackValidationError(workflow_data)