Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Ajv type coercion

node v10.24.1
version: master
endpointsharetweet
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"]}
Loading…

no comments

    sign in to comment