const Ajv = require("ajv")
const ajv1 = new Ajv({allErrors: true})
const ajv2 = new Ajv({allErrors: true, inlineRefs: false})
propertySchema = {
type: "string",
minLength: 1,
maxLength: 100,
pattern: "^\d+quot;
}
const schema1 = {
type: "object",
properties: {}
}
const schema2 = {
$defs: {
prop: propertySchema
},
type: "object",
properties: {}
}
for (let i = 0; i < 1000; i++) {
schema1.properties[`prop${i}`] = propertySchema
schema2.properties[`prop${i}`] = {$ref: "#/$defs/prop"}
}
const validate1 = ajv1.compile(schema1)
const validate2_1 = ajv1.compile(schema2)
const validate2_2 = ajv2.compile(schema2)
console.log(validate1.toString().length)
console.log(validate2_1.toString().length)
console.log(validate2_2.toString().length)