MCPcopy
hub / github.com/ajv-validator/ajv / validateProperties

Function validateProperties

lib/vocabularies/applicator/patternProperties.ts:62–87  ·  view source on GitHub ↗
(pat: string)

Source from the content-addressed store, hash-verified

60 }
61
62 function validateProperties(pat: string): void {
63 gen.forIn("key", data, (key) => {
64 gen.if(_`${usePattern(cxt, pat)}.test(${key})`, () => {
65 const alwaysValid = alwaysValidPatterns.includes(pat)
66 if (!alwaysValid) {
67 cxt.subschema(
68 {
69 keyword: "patternProperties",
70 schemaProp: pat,
71 dataProp: key,
72 dataPropType: Type.Str,
73 },
74 valid
75 )
76 }
77
78 if (it.opts.unevaluated && props !== true) {
79 gen.assign(_`${props}[${key}]`, true)
80 } else if (!alwaysValid && !it.allErrors) {
81 // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false)
82 // or if all properties were evaluated (props === true)
83 gen.if(not(valid), () => gen.break())
84 }
85 })
86 })
87 }
88 },
89}
90

Callers 1

Calls 8

_Function · 0.90
usePatternFunction · 0.90
notFunction · 0.90
forInMethod · 0.80
ifMethod · 0.80
subschemaMethod · 0.80
assignMethod · 0.80
breakMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…