Skip to content

Commit

Permalink
use requires cache in favor of making own
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Livingston committed Sep 8, 2014
1 parent e075357 commit 5a8363b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/schema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ var tv4 = require('tv4'),
thing = require('core-util-is'),
path = require('path');

var cache, schemaPath, baseSchemaPath, baseSchema, modelSchema;
var schemaPath, baseSchemaPath, baseSchema, modelSchema;

cache = {};
schemaPath = path.join(__dirname, 'swagger-spec/schemas/v1.2');
baseSchemaPath = path.join(schemaPath, 'apiDeclaration.json');
modelSchema = require(path.join(schemaPath, 'modelsObject'));
Expand All @@ -22,7 +21,6 @@ fs.readdirSync(schemaPath).forEach(function (file) {
var schema;

schema = require(path.join(schemaPath, file));
cache[file] = schema;

tv4.addSchema(schema);
});
Expand All @@ -38,7 +36,7 @@ module.exports = {
var results;

if (thing.isString(schema)) {
schema = cache[schema];
schema = require(path.join(schemaPath, schema));
}

results = tv4.validateResult(data, schema || baseSchema, true);
Expand Down

0 comments on commit 5a8363b

Please sign in to comment.