def validate_schema(self, payload): """ Validates application definiition against schema """ schema = load_json_schema('username-schema.json') try: validate(payload, schema) except ValidationError as v_err: self.logger.warning('Schema validation error: %s', v_err) return { 'error': 'Failed schema validation', 'message': v_err.message, 'data': payload }, 422 except Exception as ex: # pylint: disable=broad-except self.logger.error('Unknown schema validation error: %s', ex) return { 'error': 'Unkown schema validation', 'message': ex, 'data': payload }, 400 return { 'message': 'Application defininion passed schema validation' }, 200
def validate_schema(self, payload): ''' validates schema application definition against schema ''' schema = load_json_schema('games-schema.json') try: validate(payload, schema) except ValidationError as v_err: self.logger.warning('Schema validation error: %s', v_err) return { 'error': 'Failed schema validation', 'message': v_err.message, 'data': payload }, 422 except Exception as ex: self.logger.error('Unknown schema validation error: %s', ex) return { 'error': 'Failed schema validation', 'message': ex, 'data': payload }, 400 return { 'message': 'Application definition passed schema validation' }, 200