const Ajv = require("ajv@6.12.3")
var ajv = new Ajv({ coerceTypes: "array" });
var schema = {
properties: {
foo: {type: "number"}
}
};
var data = {foo: ["abc"]}
var validate = ajv.compile(schema);
console.log(validate(data)); // true, but must be false - fixed in 6.12.4
console.log(data); // {"foo": ["abc"]}