def __validate_arguments()

in financial_functions/lambda_handlers.py [0:0]


def __validate_arguments(function_name, arguments_json, json_schema):
    """
    Validate the arguments in the provided JSON against the provided json schema
    :param function_name:
    :param arguments_json:
    :param json_schema:
    :return: Dict containing whether the provided json is valid and an error message if validation failed.
    """
    try:
        validate(arguments_json, json_schema)
        return {'isValid': True}
    except ValidationError as err:
        logger.error("Invalid {} request with args: {}. Exception: {}".format(function_name, arguments_json, err))
        return {'isValid': False, 'error': err.message}