Socket
Socket
Sign inDemoInstall

ajv

Package Overview
Dependencies
Maintainers
1
Versions
355
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajv - npm Package Compare versions

Comparing version 0.4.10 to 0.4.12

spec/tests/issues/12_restoring_root_after_resolve.json

27

lib/compile/resolve.js
'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);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc