Comparing version 0.4.10 to 0.4.12
'use strict'; | ||
var url = require('url') | ||
, equal = require('./equal'); | ||
, equal = require('./equal') | ||
, util = require('./util'); | ||
@@ -24,4 +25,9 @@ module.exports = resolve; | ||
if (typeof refVal == 'function') return refVal; | ||
var currentRoot = util.copy(root); | ||
var schema = _resolve.call(this, root, ref); | ||
if (schema) return this._refs[ref] = compile.call(this, schema, root); | ||
var v; | ||
if (typeof schema == 'function') v = this._refs[ref] = schema; | ||
else if (schema) v = this._refs[ref] = compile.call(this, schema, root); | ||
util.copy(currentRoot, root); | ||
return v; | ||
}; | ||
@@ -42,6 +48,10 @@ | ||
// } | ||
if (typeof refVal == 'function') replaceRoot(root, refVal); | ||
if (typeof refVal == 'function') util.copy(refVal, root); | ||
else { | ||
var refVal = this._schemas[normalizeId(refPath)]; | ||
if (typeof refVal == 'function') replaceRoot(root, refVal); | ||
var id = normalizeId(refPath); | ||
var refVal = this._schemas[id]; | ||
if (typeof refVal == 'function') { | ||
if (id == normalizeId(ref)) return refVal; | ||
util.copy(refVal, root); | ||
} | ||
} | ||
@@ -73,9 +83,2 @@ if (!root.schema) return; | ||
function replaceRoot(root, withRoot) { | ||
root.schema = withRoot.schema; | ||
root.refVal = withRoot.refVal; | ||
root.refs = withRoot.refs; | ||
} | ||
function unescapeFragment(str) { | ||
@@ -82,0 +85,0 @@ return decodeURIComponent(str) |
{ | ||
"name": "ajv", | ||
"version": "0.4.10", | ||
"version": "0.4.12", | ||
"description": "Another JSON schema Validator", | ||
@@ -5,0 +5,0 @@ "main": "lib/ajv.js", |
@@ -22,3 +22,3 @@ 'use strict'; | ||
// 'schemas/advanced' | ||
// 'issues/2_root_ref_in_ref' | ||
'issues/12_restoring_root_after_resolve' | ||
// ]; | ||
@@ -68,3 +68,3 @@ | ||
testSets.forEach(function (testSet) { | ||
// if (testSet.description != 'remote ref, containing refs itself') return; | ||
// if (testSet.description != 'restoring root after ref resolution (#12)') return; | ||
(testSet.skip ? describe.skip : describe)(testSet.description, function() { | ||
@@ -80,3 +80,3 @@ var validate, fullValidate; | ||
testSet.tests.forEach(function (test) { | ||
// if (test.description != 'valid') return; | ||
// if (test.description != 'valid number') return; | ||
(test.skip ? it.skip : it)(test.description, function() { | ||
@@ -83,0 +83,0 @@ var valid = validate(test.data); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
270938
119
8106