Compile dot templates
parent
2a8ce631dd
commit
b7877a2dcf
|
@ -35,15 +35,15 @@ module.exports = function anonymous(it) {
|
|||
if (it.opts.missingRefs == 'fail') {
|
||||
console.log($message);
|
||||
if (it.wasTop && $breakOnError) {
|
||||
out += ' validate.errors = [ { keyword: \'' + ('$ref') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'can\\\'t resolve reference ' + ($schema) + '\' ';
|
||||
out += ' validate.errors = [ { keyword: \'' + ('$ref') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' ';
|
||||
if (it.opts.verbose) {
|
||||
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
|
||||
out += ', schema: \'' + (it.util.escapeQuotes($schema)) + '\', data: ' + ($data);
|
||||
}
|
||||
out += ' }]; return false; ';
|
||||
} else {
|
||||
out += ' var err = { keyword: \'' + ('$ref') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'can\\\'t resolve reference ' + ($schema) + '\' ';
|
||||
out += ' var err = { keyword: \'' + ('$ref') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' ';
|
||||
if (it.opts.verbose) {
|
||||
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
|
||||
out += ', schema: \'' + (it.util.escapeQuotes($schema)) + '\', data: ' + ($data);
|
||||
}
|
||||
out += ' }; if (validate.errors === null) validate.errors = [err]; else validate.errors.push(err); errors++; ';
|
||||
}
|
||||
|
|
|
@ -43,11 +43,11 @@ module.exports = function anonymous(it) {
|
|||
if (it.wasTop && $breakOnError) {
|
||||
out += ' validate.errors = [ { keyword: \'' + ('dependencies') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'';
|
||||
if ($deps.length == 1) {
|
||||
out += 'property ' + ($deps[0]) + ' is';
|
||||
out += 'property ' + (it.util.escapeQuotes($deps[0])) + ' is';
|
||||
} else {
|
||||
out += 'properties ' + ($deps.join(", ")) + ' are';
|
||||
out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))) + ' are';
|
||||
}
|
||||
out += ' required when property ' + ($property) + ' is present\' ';
|
||||
out += ' required when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
|
||||
if (it.opts.verbose) {
|
||||
out += ', schema: validate.schema' + ($schemaPath) + ', data: ' + ($data);
|
||||
}
|
||||
|
@ -55,11 +55,11 @@ module.exports = function anonymous(it) {
|
|||
} else {
|
||||
out += ' var err = { keyword: \'' + ('dependencies') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'';
|
||||
if ($deps.length == 1) {
|
||||
out += 'property ' + ($deps[0]) + ' is';
|
||||
out += 'property ' + (it.util.escapeQuotes($deps[0])) + ' is';
|
||||
} else {
|
||||
out += 'properties ' + ($deps.join(", ")) + ' are';
|
||||
out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))) + ' are';
|
||||
}
|
||||
out += ' required when property ' + ($property) + ' is present\' ';
|
||||
out += ' required when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
|
||||
if (it.opts.verbose) {
|
||||
out += ', schema: validate.schema' + ($schemaPath) + ', data: ' + ($data);
|
||||
}
|
||||
|
|
|
@ -22,15 +22,15 @@ module.exports = function anonymous(it) {
|
|||
}
|
||||
out += ') { ';
|
||||
if (it.wasTop && $breakOnError) {
|
||||
out += ' validate.errors = [ { keyword: \'' + ('format') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should match format ' + ($schema) + '\' ';
|
||||
out += ' validate.errors = [ { keyword: \'' + ('format') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should match format ' + (it.util.escapeQuotes($schema)) + '\' ';
|
||||
if (it.opts.verbose) {
|
||||
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
|
||||
out += ', schema: \'' + (it.util.escapeQuotes($schema)) + '\', data: ' + ($data);
|
||||
}
|
||||
out += ' }]; return false; ';
|
||||
} else {
|
||||
out += ' var err = { keyword: \'' + ('format') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should match format ' + ($schema) + '\' ';
|
||||
out += ' var err = { keyword: \'' + ('format') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should match format ' + (it.util.escapeQuotes($schema)) + '\' ';
|
||||
if (it.opts.verbose) {
|
||||
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
|
||||
out += ', schema: \'' + (it.util.escapeQuotes($schema)) + '\', data: ' + ($data);
|
||||
}
|
||||
out += ' }; if (validate.errors === null) validate.errors = [err]; else validate.errors.push(err); errors++; ';
|
||||
}
|
||||
|
|
|
@ -15,15 +15,15 @@ module.exports = function anonymous(it) {
|
|||
new RegExp($schema);
|
||||
out += 'if (! /' + (it.util.escapeRegExp($schema)) + '/.test(' + ($data) + ') ) { ';
|
||||
if (it.wasTop && $breakOnError) {
|
||||
out += ' validate.errors = [ { keyword: \'' + ('pattern') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should match pattern "' + ($schema) + '"\' ';
|
||||
out += ' validate.errors = [ { keyword: \'' + ('pattern') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should match pattern "' + (it.util.escapeQuotes($schema)) + '"\' ';
|
||||
if (it.opts.verbose) {
|
||||
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
|
||||
out += ', schema: \'' + (it.util.escapeQuotes($schema)) + '\', data: ' + ($data);
|
||||
}
|
||||
out += ' }]; return false; ';
|
||||
} else {
|
||||
out += ' var err = { keyword: \'' + ('pattern') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should match pattern "' + ($schema) + '"\' ';
|
||||
out += ' var err = { keyword: \'' + ('pattern') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should match pattern "' + (it.util.escapeQuotes($schema)) + '"\' ';
|
||||
if (it.opts.verbose) {
|
||||
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
|
||||
out += ', schema: \'' + (it.util.escapeQuotes($schema)) + '\', data: ' + ($data);
|
||||
}
|
||||
out += ' }; if (validate.errors === null) validate.errors = [err]; else validate.errors.push(err); errors++; ';
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ module.exports = function anonymous(it) {
|
|||
if (it.wasTop && $breakOnError) {
|
||||
out += ' validate.errors = [ { keyword: \'' + ('type') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should be ';
|
||||
if ($isArray) {
|
||||
out += '' + ($typeSchema.join(","));
|
||||
out += '' + (it.util.escapeQuotes($typeSchema.join(",")));
|
||||
} else {
|
||||
out += '' + ($typeSchema);
|
||||
out += '' + (it.util.escapeQuotes($typeSchema));
|
||||
}
|
||||
out += '\' ';
|
||||
if (it.opts.verbose) {
|
||||
|
@ -73,7 +73,7 @@ module.exports = function anonymous(it) {
|
|||
if ($isArray) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '\'' + ($typeSchema) + '\'';
|
||||
out += '\'' + (it.util.escapeQuotes($typeSchema)) + '\'';
|
||||
}
|
||||
out += ', data: ' + ($data);
|
||||
}
|
||||
|
@ -81,9 +81,9 @@ module.exports = function anonymous(it) {
|
|||
} else {
|
||||
out += ' var err = { keyword: \'' + ('type') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should be ';
|
||||
if ($isArray) {
|
||||
out += '' + ($typeSchema.join(","));
|
||||
out += '' + (it.util.escapeQuotes($typeSchema.join(",")));
|
||||
} else {
|
||||
out += '' + ($typeSchema);
|
||||
out += '' + (it.util.escapeQuotes($typeSchema));
|
||||
}
|
||||
out += '\' ';
|
||||
if (it.opts.verbose) {
|
||||
|
@ -91,7 +91,7 @@ module.exports = function anonymous(it) {
|
|||
if ($isArray) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '\'' + ($typeSchema) + '\'';
|
||||
out += '\'' + (it.util.escapeQuotes($typeSchema)) + '\'';
|
||||
}
|
||||
out += ', data: ' + ($data);
|
||||
}
|
||||
|
@ -121,9 +121,9 @@ module.exports = function anonymous(it) {
|
|||
if (it.wasTop && $breakOnError) {
|
||||
out += ' validate.errors = [ { keyword: \'' + ('type') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should be ';
|
||||
if ($isArray) {
|
||||
out += '' + ($typeSchema.join(","));
|
||||
out += '' + (it.util.escapeQuotes($typeSchema.join(",")));
|
||||
} else {
|
||||
out += '' + ($typeSchema);
|
||||
out += '' + (it.util.escapeQuotes($typeSchema));
|
||||
}
|
||||
out += '\' ';
|
||||
if (it.opts.verbose) {
|
||||
|
@ -131,7 +131,7 @@ module.exports = function anonymous(it) {
|
|||
if ($isArray) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '\'' + ($typeSchema) + '\'';
|
||||
out += '\'' + (it.util.escapeQuotes($typeSchema)) + '\'';
|
||||
}
|
||||
out += ', data: ' + ($data);
|
||||
}
|
||||
|
@ -139,9 +139,9 @@ module.exports = function anonymous(it) {
|
|||
} else {
|
||||
out += ' var err = { keyword: \'' + ('type') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'should be ';
|
||||
if ($isArray) {
|
||||
out += '' + ($typeSchema.join(","));
|
||||
out += '' + (it.util.escapeQuotes($typeSchema.join(",")));
|
||||
} else {
|
||||
out += '' + ($typeSchema);
|
||||
out += '' + (it.util.escapeQuotes($typeSchema));
|
||||
}
|
||||
out += '\' ';
|
||||
if (it.opts.verbose) {
|
||||
|
@ -149,7 +149,7 @@ module.exports = function anonymous(it) {
|
|||
if ($isArray) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '\'' + ($typeSchema) + '\'';
|
||||
out += '\'' + (it.util.escapeQuotes($typeSchema)) + '\'';
|
||||
}
|
||||
out += ', data: ' + ($data);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue