spec/lib/task-data/schemas/schema-ut-helper.js
function loadSchemas(ajv) {
    var metaSchema = helper.require('/lib/task-data/schemas/rackhd-task-schema.json');
    ajv.addMetaSchema(metaSchema, 'rackhd-task-schema.json');
    var fileNames = glob.sync(helper.relativeToRoot('/lib/task-data/schemas/*.json'));
    _(fileNames).filter(function (filename) {
        return path.basename(filename) !== 'rackhd-task-schema.json';
    })
    .forEach(function (filename) {
        try {
            var data = fs.readFileSync(filename).toString();
            jsonlint.parse(data);
            ajv.addSchema(JSON.parse(data), path.basename(filename));
        }
        catch(err) {
            console.error('fail to add schema: ' + filename);
            throw err;
        }
    })
    .value();
    return ajv;
}
function loadSchemas(ajv) {
    var metaSchema = helper.require('/lib/task-data/schemas/rackhd-task-schema.json');
    ajv.addMetaSchema(metaSchema, 'rackhd-task-schema.json');
    var fileNames = glob.sync(helper.relativeToRoot('/lib/task-data/schemas/*.json'));
    _(fileNames).filter(function (filename) {
        return path.basename(filename) !== 'rackhd-task-schema.json';
    })
    .forEach(function (filename) {
        try {
            var data = fs.readFileSync(filename).toString();
            jsonlint.parse(data);
            ajv.addSchema(JSON.parse(data), path.basename(filename));
        }
        catch(err) {
            console.error('fail to add schema: ' + filename);
            throw err;
        }
    })
    .value();
    return ajv;
}
function loadSchemas ( ajv ) { var metaSchema = helper . require ( '/lib/task-data/schemas/rackhd-task-schema.json' ) ; ajv . addMetaSchema ( metaSchema , 'rackhd-task-schema.json' ) ; var fileNames = glob . sync ( helper . relativeToRoot ( '/lib/task-data/schemas/*.json' ) ) ; _ ( fileNames ) . filter ( function ( filename ) { return path . basename ( filename ) !== 'rackhd-task-schema.json' ; } ) . forEach ( function ( filename ) { try { var data = fs . readFileSync ( filename ) . toString ( ) ; jsonlint . parse ( data ) ; ajv . addSchema ( JSON . parse ( data ) , path . basename ( filename ) ) ; } catch ( err ) { console . error ( 'fail to add schema: ' + filename ) ; throw err ; } } ) . value ( ) ; return ajv ; }
load all schemas into the validator to resolve all schema references
@param {Object} ajv - The Ajv instance
@return {Object} the input Ajv instance
load all schemas into the validator to resolve all schema references