prevent possible issues like #13

master
Evgeny Poberezkin 2015-06-19 00:59:16 +01:00
parent cbdd00e9c6
commit 4e1f0e54c4
2 changed files with 4 additions and 3 deletions

View File

@ -19,6 +19,7 @@ function compile(schema, root) {
var isRoot = !root || (root && root.schema == schema);
root = root || { schema: schema, refVal: refVal, refs: refs };
var rootRefs = root.refs;
var rootRefVal = root.refVal;
var formats = this._formats;
@ -68,9 +69,9 @@ function compile(schema, root) {
ref = resolve.url(baseId, ref);
if (refs[ref]) return 'refVal[' + refs[ref] + ']';
if (!isRoot) {
var rootRefId = root.refs[ref];
var rootRefId = rootRefs[ref];
if (rootRefId !== undefined)
return addLocalRef(ref, root.refVal[rootRefId]);
return addLocalRef(ref, rootRefVal[rootRefId]);
}
var v = resolve.call(self, compile, root, ref);
if (v) return addLocalRef(ref, v);

View File

@ -1,6 +1,6 @@
{
"name": "ajv",
"version": "0.5.5",
"version": "0.5.6",
"description": "Another JSON schema Validator",
"main": "lib/ajv.js",
"scripts": {