Comparing version 8.10.0 to 8.11.0
@@ -60,3 +60,3 @@ "use strict"; | ||
if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) { | ||
sch = compile_1.resolveRef.call(it.self, it.schemaEnv, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref); | ||
sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref); | ||
if (sch instanceof compile_1.SchemaEnv) | ||
@@ -63,0 +63,0 @@ sch = sch.schema; |
@@ -20,3 +20,4 @@ "use strict"; | ||
const useLoop = schema.length >= it.opts.loopEnum; | ||
const eql = (0, util_1.useFunc)(gen, equal_1.default); | ||
let eql; | ||
const getEql = () => (eql !== null && eql !== void 0 ? eql : (eql = (0, util_1.useFunc)(gen, equal_1.default))); | ||
let valid; | ||
@@ -37,3 +38,3 @@ if (useLoop || $data) { | ||
gen.assign(valid, false); | ||
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${eql}(${data}, ${v})`, () => gen.assign(valid, true).break())); | ||
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break())); | ||
} | ||
@@ -43,3 +44,3 @@ function equalCode(vSchema, i) { | ||
return typeof sch === "object" && sch !== null | ||
? (0, codegen_1._) `${eql}(${data}, ${vSchema}[${i}])` | ||
? (0, codegen_1._) `${getEql()}(${data}, ${vSchema}[${i}])` | ||
: (0, codegen_1._) `${data} === ${sch}`; | ||
@@ -46,0 +47,0 @@ } |
@@ -7,3 +7,3 @@ "use strict"; | ||
const comp = keyword === "maxProperties" ? "more" : "fewer"; | ||
return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} items`; | ||
return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} properties`; | ||
}, | ||
@@ -10,0 +10,0 @@ params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, |
@@ -69,3 +69,3 @@ import type {CodeKeywordDefinition, AnySchemaObject, KeywordErrorDefinition} from "../../types" | ||
if (sch?.$ref && !schemaHasRulesButRef(sch, it.self.RULES)) { | ||
sch = resolveRef.call(it.self, it.schemaEnv, it.baseId, sch?.$ref) | ||
sch = resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch?.$ref) | ||
if (sch instanceof SchemaEnv) sch = sch.schema | ||
@@ -72,0 +72,0 @@ } |
@@ -23,3 +23,5 @@ import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" | ||
const useLoop = schema.length >= it.opts.loopEnum | ||
const eql = useFunc(gen, equal) | ||
let eql: Name | undefined | ||
const getEql = (): Name => (eql ??= useFunc(gen, equal)) | ||
let valid: Code | ||
@@ -40,3 +42,3 @@ if (useLoop || $data) { | ||
gen.forOf("v", schemaCode as Code, (v) => | ||
gen.if(_`${eql}(${data}, ${v})`, () => gen.assign(valid, true).break()) | ||
gen.if(_`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()) | ||
) | ||
@@ -48,3 +50,3 @@ } | ||
return typeof sch === "object" && sch !== null | ||
? _`${eql}(${data}, ${vSchema}[${i}])` | ||
? _`${getEql()}(${data}, ${vSchema}[${i}])` | ||
: _`${data} === ${sch}` | ||
@@ -51,0 +53,0 @@ } |
@@ -8,3 +8,3 @@ import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" | ||
const comp = keyword === "maxProperties" ? "more" : "fewer" | ||
return str`must NOT have ${comp} than ${schemaCode} items` | ||
return str`must NOT have ${comp} than ${schemaCode} properties` | ||
}, | ||
@@ -11,0 +11,0 @@ params: ({schemaCode}) => _`{limit: ${schemaCode}}`, |
{ | ||
"name": "ajv", | ||
"version": "8.10.0", | ||
"version": "8.11.0", | ||
"description": "Another JSON Schema Validator", | ||
@@ -5,0 +5,0 @@ "main": "dist/ajv.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1016907
19862