MCPcopy Create free account
hub / github.com/json-editor/json-editor / additionalPropertyCode

Function additionalPropertyCode

docs/scripts/ajv-validator.js:4509–4536  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

4507 gen.code((0, codegen_1._) `delete ${data}[${key}]`);
4508 }
4509 function additionalPropertyCode(key) {
4510 if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) {
4511 deleteAdditional(key);
4512 return;
4513 }
4514 if (schema === false) {
4515 cxt.setParams({ additionalProperty: key });
4516 cxt.error();
4517 if (!allErrors)
4518 gen.break();
4519 return;
4520 }
4521 if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
4522 const valid = gen.name("valid");
4523 if (opts.removeAdditional === "failing") {
4524 applyAdditionalSchema(key, valid, false);
4525 gen.if((0, codegen_1.not)(valid), () => {
4526 cxt.reset();
4527 deleteAdditional(key);
4528 });
4529 }
4530 else {
4531 applyAdditionalSchema(key, valid);
4532 if (!allErrors)
4533 gen.if((0, codegen_1.not)(valid), () => gen.break());
4534 }
4535 }
4536 }
4537 function applyAdditionalSchema(key, valid, errors) {
4538 const subschema = {
4539 keyword: "additionalProperties",

Callers 1

Calls 8

deleteAdditionalFunction · 0.85
applyAdditionalSchemaFunction · 0.85
setParamsMethod · 0.80
errorMethod · 0.80
breakMethod · 0.80
resetMethod · 0.80
nameMethod · 0.45
ifMethod · 0.45

Tested by

no test coverage detected