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

Function validateProperties

docs/scripts/ajv-validator.js:5240–5262  ·  view source on GitHub ↗
(pat)

Source from the content-addressed store, hash-verified

5238 }
5239 }
5240 function validateProperties(pat) {
5241 gen.forIn("key", data, (key) => {
5242 gen.if((0, codegen_1._) `${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => {
5243 const alwaysValid = alwaysValidPatterns.includes(pat);
5244 if (!alwaysValid) {
5245 cxt.subschema({
5246 keyword: "patternProperties",
5247 schemaProp: pat,
5248 dataProp: key,
5249 dataPropType: util_2.Type.Str,
5250 }, valid);
5251 }
5252 if (it.opts.unevaluated && props !== true) {
5253 gen.assign((0, codegen_1._) `${props}[${key}]`, true);
5254 }
5255 else if (!alwaysValid && !it.allErrors) {
5256 // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false)
5257 // or if all properties were evaluated (props === true)
5258 gen.if((0, codegen_1.not)(valid), () => gen.break());
5259 }
5260 });
5261 });
5262 }
5263 },
5264 };
5265 exports.default = def;

Callers 1

Calls 5

forInMethod · 0.80
subschemaMethod · 0.80
assignMethod · 0.80
breakMethod · 0.80
ifMethod · 0.45

Tested by

no test coverage detected