removed unused code
parent
f19f7fdedf
commit
0576ea986e
|
@ -23,7 +23,6 @@ function Ajv(opts) {
|
|||
this.opts = opts || {};
|
||||
this._schemas = {};
|
||||
this._refs = {};
|
||||
this._missing = {};
|
||||
this._byJson = {};
|
||||
this._formats = formats(this.opts.format);
|
||||
|
||||
|
@ -165,8 +164,7 @@ function Ajv(opts) {
|
|||
|
||||
|
||||
function checkUnique(id) {
|
||||
var schemaRef = self._refs[id];
|
||||
if (self._schemas[id] || (schemaRef && !schemaRef.missing))
|
||||
if (self._schemas[id] || self._refs[id])
|
||||
throw new Error('schema with key or id "' + id + '" already exists');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ resolve.normalizeId = normalizeId;
|
|||
resolve.fullPath = getFullPath;
|
||||
resolve.url = resolveUrl;
|
||||
resolve.ids = resolveIds;
|
||||
resolve.missing = resolveMissing;
|
||||
|
||||
|
||||
function resolve(compile, root, ref) {
|
||||
|
@ -37,13 +36,8 @@ function _resolve(root, ref) {
|
|||
, refPath = _getFullPath(p)
|
||||
, baseId = getFullPath(root.schema.id);
|
||||
if (refPath !== baseId) {
|
||||
// rootSchema = undefined; TODO this breaks resolution in meta-schema
|
||||
var refVal = this._refs[refPath];
|
||||
if (typeof refVal == 'string') refVal = this._refs[refVal];
|
||||
// {
|
||||
// if (this._refs[refVal]) refVal = this._refs[refVal];
|
||||
// else refVal = resolve.call(this, rootSchema, refVal);
|
||||
// }
|
||||
if (typeof refVal == 'function') util.copy(refVal, root);
|
||||
else {
|
||||
var id = normalizeId(refPath);
|
||||
|
@ -56,9 +50,14 @@ function _resolve(root, ref) {
|
|||
if (!root.schema) return;
|
||||
baseId = getFullPath(root.schema.id);
|
||||
}
|
||||
p.hash = p.hash || '';
|
||||
if (p.hash.slice(0,2) != '#/') return;
|
||||
var parts = p.hash.split('/');
|
||||
return getJsonPointer.call(this, p, baseId, root);
|
||||
}
|
||||
|
||||
|
||||
function getJsonPointer(parsedRef, baseId, root) {
|
||||
parsedRef.hash = parsedRef.hash || '';
|
||||
if (parsedRef.hash.slice(0,2) != '#/') return;
|
||||
var parts = parsedRef.hash.split('/');
|
||||
var schema = root.schema;
|
||||
|
||||
for (var i = 1; i < parts.length; i++) {
|
||||
|
@ -138,16 +137,8 @@ function _resolveIds(schema, fullPath, baseId) {
|
|||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
} else if (id != normalizeId(fullPath))
|
||||
this._refs[id] = fullPath;
|
||||
|
||||
// TODO check and resolve missing
|
||||
|
||||
}
|
||||
for (var key in schema)
|
||||
_resolveIds.call(this, schema[key], fullPath+'/'+escapeFragment(key), baseId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function resolveMissing(schema, schemaRef) {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ajv",
|
||||
"version": "0.4.12",
|
||||
"version": "0.4.14",
|
||||
"description": "Another JSON schema Validator",
|
||||
"main": "lib/ajv.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in New Issue