Comparing version 0.1.0 to 0.1.1
@@ -19,2 +19,3 @@ 'use strict'; | ||
var validateCode = validateTemplate({ | ||
isRoot: true, | ||
schema: schema, | ||
@@ -21,0 +22,0 @@ schemaPath: '', |
@@ -12,6 +12,5 @@ function (data, dataType, dataPath) { | ||
keyword: '$ref', | ||
schema: '{{= it.schema }}', | ||
dataPath: dataPath, | ||
message: 'can\'t resolve reference {{= it.schema}}' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: '{{= it.schema }}', data: data{{?}} | ||
}); | ||
@@ -18,0 +17,0 @@ return false; |
@@ -24,6 +24,5 @@ function (data, dataType, dataPath) { | ||
keyword: 'dependencies', | ||
schema: validate.schema{{= it.schemaPath }}, | ||
dataPath: dataPath, | ||
message: '{{? $deps.length == 1 }}property {{= $deps[0] }} is{{??}}properties {{= $deps.join(",") }} are{{?}} required when property {{= $property }} is present' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: validate.schema{{= it.schemaPath }}, data: data{{?}} | ||
}); | ||
@@ -30,0 +29,0 @@ |
@@ -17,6 +17,5 @@ function (data, dataType, dataPath) { | ||
keyword: 'enum', | ||
schema: validate.schema{{= it.schemaPath }}, | ||
dataPath: dataPath, | ||
message: 'should be equal to one of values' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: validate.schema{{= it.schemaPath }}, data: data{{?}} | ||
}); | ||
@@ -23,0 +22,0 @@ |
@@ -9,6 +9,5 @@ {{? it.opts.format !== false }} | ||
keyword: 'format', | ||
schema: '{{= it.schema.format }}', | ||
dataPath: dataPath, | ||
message: 'should match format "{{= it.schema.format }}"' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: '{{= it.schema.format }}', data: data{{?}} | ||
}); | ||
@@ -15,0 +14,0 @@ {{??}} |
@@ -40,111 +40,1 @@ 'use strict'; | ||
}); | ||
// { | ||
// type: { code: fs.readFileSync(__dirname + '/type.dot.js'), inline: true, order: 10 }, | ||
// enum: { code: fs.readFileSync(__dirname + '/enum.dot.js'), order: 80 }, | ||
// allOf: { code: fs.readFileSync(__dirname + '/allOf.dot.js'), order: 110 }, | ||
// anyOf: { code: fs.readFileSync(__dirname + '/anyOf.dot.js'), order: 100 }, | ||
// oneOf: { code: fs.readFileSync(__dirname + '/oneOf.dot.js'), order: 110 }, | ||
// not: { code: fs.readFileSync(__dirname + '/not.dot.js'), order: 90 }, | ||
// maximum: { // includes exclusiveMaximum | ||
// code: fs.readFileSync(__dirname + '/maximum.dot.js'), | ||
// type: 'number', | ||
// inline: true, | ||
// order: 20 | ||
// }, | ||
// minimum: { // includes exclusiveMinimum | ||
// code: fs.readFileSync(__dirname + '/minimum.dot.js'), | ||
// type: 'number', | ||
// inline: true, | ||
// order: 20 | ||
// }, | ||
// multipleOf: { | ||
// code: fs.readFileSync(__dirname + '/multipleOf.dot.js'), | ||
// type: 'number', | ||
// inline: true, | ||
// order: 40 | ||
// }, | ||
// maxLength: { | ||
// code: fs.readFileSync(__dirname + '/maxLength.dot.js'), | ||
// type: 'string', | ||
// inline: true, | ||
// order: 50 | ||
// }, | ||
// minLength: { | ||
// code: fs.readFileSync(__dirname + '/minLength.dot.js'), | ||
// type: 'string', | ||
// inline: true, | ||
// order: 50 | ||
// }, | ||
// pattern: { | ||
// code: fs.readFileSync(__dirname + '/pattern.dot.js'), | ||
// type: 'string', | ||
// inline: true, | ||
// order: 60 | ||
// }, | ||
// format: { | ||
// code: fs.readFileSync(__dirname + '/format.dot.js'), | ||
// type: 'string', | ||
// inline: true, | ||
// order: 70 | ||
// }, | ||
// items: { // includes additionalItems | ||
// code: fs.readFileSync(__dirname + '/items.dot.js'), | ||
// type: 'array', | ||
// order: 120 | ||
// }, | ||
// maxItems: { | ||
// code: fs.readFileSync(__dirname + '/maxItems.dot.js'), | ||
// type: 'array', | ||
// inline: true, | ||
// order: 20 | ||
// }, | ||
// minItems: { | ||
// code: fs.readFileSync(__dirname + '/minItems.dot.js'), | ||
// type: 'array', | ||
// inline: true, | ||
// order: 20 | ||
// }, | ||
// uniqueItems: { | ||
// code: fs.readFileSync(__dirname + '/uniqueItems.dot.js'), | ||
// type: 'array', | ||
// order: 110 | ||
// }, | ||
// maxProperties: { | ||
// code: fs.readFileSync(__dirname + '/maxProperties.dot.js'), | ||
// type: 'object', | ||
// inline: true, | ||
// order: 30 | ||
// }, | ||
// minProperties: { | ||
// code: fs.readFileSync(__dirname + '/minProperties.dot.js'), | ||
// type: 'object', | ||
// inline: true, | ||
// order: 30 | ||
// }, | ||
// required: { | ||
// code: fs.readFileSync(__dirname + '/required.dot.js'), | ||
// type: 'object', | ||
// inline: true, | ||
// order: 80 | ||
// }, | ||
// properties: { // includes patternProperties and additionalProperties | ||
// code: fs.readFileSync(__dirname + '/properties.dot.js'), | ||
// type: 'object', | ||
// order: 130 | ||
// }, | ||
// dependencies: { | ||
// code: fs.readFileSync(__dirname + '/dependencies.dot.js'), | ||
// type: 'object', | ||
// order: 140 | ||
// }, | ||
// $ref: { | ||
// code: fs.readFileSync(__dirname + '/$ref.dot.js'), | ||
// order: 150 | ||
// } | ||
// }; |
@@ -25,6 +25,5 @@ {{## def.validateItems:startFrom: | ||
keyword: 'additionalItems', | ||
schema: false, | ||
dataPath: dataPath, | ||
message: 'should NOT have more than {{= it.schema.length }} items' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: false, data: data{{?}} | ||
}); | ||
@@ -31,0 +30,0 @@ |
@@ -10,6 +10,5 @@ {{ | ||
keyword: 'maximum', | ||
schema: {{= it.schema.maximum }}, | ||
dataPath: dataPath, | ||
message: 'should be {{= $op }} {{= it.schema.maximum }}' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.maximum }}, data: data{{?}} | ||
}); |
@@ -5,6 +5,5 @@ var valid = data.length <= {{= it.schema.maxItems }}; | ||
keyword: 'maxItems', | ||
schema: {{= it.schema.maxItems }}, | ||
dataPath: dataPath, | ||
message: 'should NOT have more than {{= it.schema.maxItems }} items' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.maxItems }}, data: data{{?}} | ||
}); |
@@ -5,6 +5,5 @@ var valid = data.length <= {{= it.schema.maxLength }}; | ||
keyword: 'maxLength', | ||
schema: {{= it.schema.maxLength }}, | ||
dataPath: dataPath, | ||
message: 'should NOT be longer than {{= it.schema.maxLength }} characters' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.maxLength }}, data: data{{?}} | ||
}); |
@@ -6,6 +6,5 @@ var propertiesNum = Object.keys(data).length; | ||
keyword: 'maxProperties', | ||
schema: {{= it.schema.maxProperties }}, | ||
dataPath: dataPath, | ||
message: 'should NOT have more than {{= it.schema.maxProperties }} properties' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.maxProperties }}, data: data{{?}} | ||
}); |
@@ -10,6 +10,5 @@ {{ | ||
keyword: 'minimum', | ||
schema: {{= it.schema.minimum }}, | ||
dataPath: dataPath, | ||
message: 'should be {{= $op }} {{= it.schema.minimum }}' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.minimum }}, data: data{{?}} | ||
}); |
@@ -5,6 +5,5 @@ var valid = data.length >= {{= it.schema.minItems }}; | ||
keyword: 'minItems', | ||
schema: {{= it.schema.minItems }}, | ||
dataPath: dataPath, | ||
message: 'should NOT have less than {{= it.schema.minItems }} items' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.minItems }}, data: data{{?}} | ||
}); |
@@ -5,6 +5,5 @@ var valid = data.length >= {{= it.schema.minLength }}; | ||
keyword: 'minLength', | ||
schema: {{= it.schema.minLength }}, | ||
dataPath: dataPath, | ||
message: 'should NOT be shorter than {{= it.schema.minLength }} characters' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.minLength }}, data: data{{?}} | ||
}); |
@@ -6,6 +6,5 @@ var propertiesNum = Object.keys(data).length; | ||
keyword: 'minProperties', | ||
schema: {{= it.schema.minProperties }}, | ||
dataPath: dataPath, | ||
message: 'should NOT have less than {{= it.schema.minProperties }} properties' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.minProperties }}, data: data{{?}} | ||
}); |
@@ -6,6 +6,5 @@ var division = data / {{= it.schema.multipleOf }}; | ||
keyword: 'multipleOf', | ||
schema: {{= it.schema.multipleOf }}, | ||
dataPath: dataPath, | ||
message: 'should be multiple of {{= it.schema.multipleOf }}' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema.multipleOf }}, data: data{{?}} | ||
}); |
@@ -13,6 +13,5 @@ function (data, dataType, dataPath) { | ||
keyword: 'not', | ||
schema: validate.schema{{= it.schemaPath }}, | ||
dataPath: dataPath, | ||
message: 'should NOT be valid' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: validate.schema{{= it.schemaPath }}, data: data{{?}} | ||
}); | ||
@@ -19,0 +18,0 @@ |
@@ -20,6 +20,5 @@ function (data, dataType, dataPath) { | ||
keyword: 'oneOf', | ||
schema: validate.schema{{= it.schemaPath }}, | ||
dataPath: dataPath, | ||
message: 'should match exactly one schema in oneOf' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: validate.schema{{= it.schemaPath }}, data: data{{?}} | ||
}); | ||
@@ -35,6 +34,5 @@ return false; | ||
keyword: 'oneOf', | ||
schema: validate.schema{{= it.schemaPath }}, | ||
dataPath: dataPath, | ||
message: 'should match exactly one schema in oneOf' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: validate.schema{{= it.schemaPath }}, data: data{{?}} | ||
}); | ||
@@ -41,0 +39,0 @@ |
@@ -6,6 +6,5 @@ {{ new RegExp(it.schema.pattern); /* test if regexp is valid to fail at compile time rather than in eval */}} | ||
keyword: 'minimum', | ||
schema: '{{= it.schema.pattern }}', | ||
dataPath: dataPath, | ||
message: 'should match pattern "{{= it.schema.pattern }}"' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: '{{= it.schema.pattern }}', data: data{{?}} | ||
}); |
@@ -44,6 +44,5 @@ {{## def.validateProperty:useKey: | ||
keyword: 'properties', | ||
schema: propertiesSchema, | ||
dataPath: dataPath, | ||
message: 'additional properties NOT allowed' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: propertiesSchema, data: data{{?}} | ||
}); | ||
@@ -88,6 +87,5 @@ | ||
keyword: 'properties', | ||
schema: propertiesSchema, | ||
dataPath: dataPath, | ||
message: 'property ' + key + ' NOT allowed' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: propertiesSchema, data: data{{?}} | ||
}); | ||
@@ -94,0 +92,0 @@ |
@@ -25,6 +25,5 @@ var valid = true, missing = ''; | ||
keyword: 'required', | ||
schema: req_schema, | ||
dataPath: dataPath, | ||
message: 'properties ' + missing + ' are missing' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: req_schema, data: data{{?}} | ||
}); |
@@ -42,3 +42,3 @@ {{## def.isInteger: | ||
dataType == '{{= $schema }}'; | ||
{{?}}; | ||
{{?}} | ||
{{?}} | ||
@@ -49,6 +49,5 @@ | ||
keyword: 'type', | ||
schema: {{? $isArray }}validate.schema{{= it.schemaPath + '.type' }}{{??}}'{{= $schema }}'{{?}}, | ||
dataPath: dataPath, | ||
message: 'data' + dataPath + ' is not valid. Expected {{? $isArray }}{{= $schema.join(",") }}{{??}}{{= $schema }}{{?}}' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
message: 'should be {{? $isArray }}{{= $schema.join(",") }}{{??}}{{= $schema }}{{?}}' | ||
{{? it.opts.verbose }}, schema: {{? $isArray }}validate.schema{{= it.schemaPath + '.type' }}{{??}}'{{= $schema }}'{{?}}, data: data{{?}} | ||
}); |
@@ -18,6 +18,5 @@ function (data, dataType, dataPath) { | ||
keyword: 'uniqueItems', | ||
schema: {{= it.schema }}, | ||
dataPath: dataPath, | ||
message: 'item #' + i + 'is duplicate' | ||
{{? it.opts.verbose }}, data: data{{?}} | ||
{{? it.opts.verbose }}, schema: {{= it.schema }}, data: data{{?}} | ||
}); | ||
@@ -24,0 +23,0 @@ |
@@ -12,13 +12,14 @@ {{ /** | ||
function (data, dataType, dataPath) { | ||
function (data{{? !it.isRoot }}, dataType, dataPath{{?}}) { | ||
'use strict'; | ||
if (!dataType) { | ||
dataType = getDataType(data); | ||
validate.errors.length = 0; | ||
dataPath = ''; | ||
} | ||
{{? it.isRoot }} | ||
{{ it.isRoot = false; }} | ||
var dataType = getDataType(data); | ||
var dataPath = ''; | ||
var errs = validate.errors.length = 0; | ||
{{??}} | ||
var errs = validate.errors.length; | ||
{{?}} | ||
var errs = validate.errors.length; | ||
{{~ it.RULES:$rulesGroup }} | ||
@@ -25,0 +26,0 @@ {{? $shouldUseGroup($rulesGroup) }} |
{ | ||
"name": "ajv", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Another JSON schema Validator", | ||
@@ -5,0 +5,0 @@ "main": "lib/ajv.js", |
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
188346
5769