spec/lib/task-data/schemas/schema-ut-helper.js
function validateData(validator, schemaId, data, expected) {
    var result = validator.validate(schemaId, data);
    if (!result && expected || result && !expected) {
        if (!result) {
            return new Error(validator.errorsText());
        }
        else {
            return new Error('expected schema violation, but get conformity.');
        }
    }
}
function validateData(validator, schemaId, data, expected) {
    var result = validator.validate(schemaId, data);
    if (!result && expected || result && !expected) {
        if (!result) {
            return new Error(validator.errorsText());
        }
        else {
            return new Error('expected schema violation, but get conformity.');
        }
    }
}
function validateData ( validator , schemaId , data , expected ) { var result = validator . validate ( schemaId , data ) ; if ( ! result && expected || result && ! expected ) { if ( ! result ) { return new Error ( validator . errorsText ( ) ) ; } else { return new Error ( 'expected schema violation, but get conformity.' ) ; } } }
validate the data against a schema
@param {Object} validator - The JSON-Schema validator instance
@param {String} schemaId - The schema id
@param {Object} data - The data that to be validated
@param {Boolean} expected - true if expect data conforms to schema, otherwise expect violation.
@return {undefined | Error} - return undefined if the validation gets expected result; Otherwise
throw error.
validate the data against a schema