Open
Description
Package Versions:
[email protected]
[email protected]
[email protected]
Problem
Hi when I was trying belowed case I got a ReferenceError: data1 is not defined
from my node. It seems that ajv's scheme compiler generates wrong code. When I change schema.foo.bar
's type definition or reduce the nesting levels the same error will not occurred again.
const Ajv = require('ajv');
const ajv = new Ajv({ allErrors: true });
require('ajv-errors')(ajv);
const schema = {
type: "object",
properties: {
foo: {
type: "object",
properties: {
bar: {
type: "string",
errorMessage: "${0}",
},
},
},
},
};
const data = {
foo: {
bar: false,
},
};
ajv.validate(schema, data);
console.log(ajv.errors);
Sincerely hope for replying.