Skip to content

Commit

Permalink
Merge pull request #178 from sauvainr/master
Browse files Browse the repository at this point in the history
Do not duplicate same schema of different instance in cache.
  • Loading branch information
zaggino authored Nov 21, 2016
2 parents 75f2870 + fe874fc commit ff8786d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
},
"dependencies": {
"lodash.get": "^4.1.2",
"lodash.isequal": "^4.4.0",
"validator": "^5.0.0"
},
"optionalDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/SchemaCache.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";

var isequal = require("lodash.isequal");
var Report = require("./Report");
var SchemaCompilation = require("./SchemaCompilation");
var SchemaValidation = require("./SchemaValidation");
Expand Down Expand Up @@ -95,7 +96,7 @@ exports.getSchema = function (report, schema) {
exports.getSchemaByReference = function (report, key) {
var i = this.referenceCache.length;
while (i--) {
if (this.referenceCache[i][0] === key) {
if (isequal(this.referenceCache[i][0], key)) {
return this.referenceCache[i][1];
}
}
Expand Down

0 comments on commit ff8786d

Please sign in to comment.