-
-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
What version of Ajv are you using?
using ajv 7.1.1 and ajv-errors 2.0.0
Your code
const schema = {
type: "object",
properties: {
foo: {type: "integer", minimum: 2}
},
errorMessage: {
properties: {
foo: "data.foo should be integer >= 2"
}
}
}
const Ajv = require("ajv").default
const ajv = new Ajv({code: {source: true}, allErrors: true})
const standaloneCode = require("ajv/dist/standalone").default
require('ajv-errors')(ajv)
const validate = ajv.compile(schema);
let moduleCode = standaloneCode(ajv, validate)
const fs = require("fs")
const path = require("path")
fs.writeFileSync(path.join(__dirname, 'schema.js'), moduleCode);
error message
node_modules\ajv\dist\compile\codegen\scope.js:134
throw new ValueError(name);
^
ValueError: CodeGen: "code" for pattern0 not defined
What results did you expect?
this kind of schema is still documented in ajv-errors 2.0.0 documentation, so i expected standalone code to be generated for that schema but seems not
Metadata
Metadata
Assignees
Labels
No labels