const util_1 = require("../../compile/util");
const error = {
message: "must NOT have additional properties",
- params: ({ params }) => codegen_1._ `{additionalProperty: ${params.additionalProperty}}`,
+ params: ({ params }) => (0, codegen_1._) `{additionalProperty: ${params.additionalProperty}}`,
};
const def = {
keyword: "additionalProperties",
throw new Error("ajv implementation error");
const { allErrors, opts } = it;
it.props = true;
- if (opts.removeAdditional !== "all" && util_1.alwaysValidSchema(it, schema))
+ if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema))
return;
- const props = code_1.allSchemaProperties(parentSchema.properties);
- const patProps = code_1.allSchemaProperties(parentSchema.patternProperties);
+ const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
+ const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
checkAdditionalProperties();
- cxt.ok(codegen_1._ `${errsCount} === ${names_1.default.errors}`);
+ cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`);
function checkAdditionalProperties() {
gen.forIn("key", data, (key) => {
if (!props.length && !patProps.length)
let definedProp;
if (props.length > 8) {
// TODO maybe an option instead of hard-coded 8?
- const propsSchema = util_1.schemaRefOrVal(it, parentSchema.properties, "properties");
- definedProp = code_1.isOwnProperty(gen, propsSchema, key);
+ const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
+ definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key);
}
else if (props.length) {
- definedProp = codegen_1.or(...props.map((p) => codegen_1._ `${key} === ${p}`));
+ definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._) `${key} === ${p}`));
}
else {
definedProp = codegen_1.nil;
}
if (patProps.length) {
- definedProp = codegen_1.or(definedProp, ...patProps.map((p) => codegen_1._ `${code_1.usePattern(gen, p)}.test(${key})`));
+ definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._) `${(0, code_1.usePattern)(cxt, p)}.test(${key})`));
}
- return codegen_1.not(definedProp);
+ return (0, codegen_1.not)(definedProp);
}
function deleteAdditional(key) {
- gen.code(codegen_1._ `delete ${data}[${key}]`);
+ gen.code((0, codegen_1._) `delete ${data}[${key}]`);
}
function additionalPropertyCode(key) {
if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) {
gen.break();
return;
}
- if (typeof schema == "object" && !util_1.alwaysValidSchema(it, schema)) {
+ if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
const valid = gen.name("valid");
if (opts.removeAdditional === "failing") {
applyAdditionalSchema(key, valid, false);
- gen.if(codegen_1.not(valid), () => {
+ gen.if((0, codegen_1.not)(valid), () => {
cxt.reset();
deleteAdditional(key);
});
else {
applyAdditionalSchema(key, valid);
if (!allErrors)
- gen.if(codegen_1.not(valid), () => gen.break());
+ gen.if((0, codegen_1.not)(valid), () => gen.break());
}
}
}