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

Function code

lib/vocabularies/applicator/propertyNames.ts:23–47  ·  view source on GitHub ↗
(cxt: KeywordCxt)

Source from the content-addressed store, hash-verified

21 schemaType: ["object", "boolean"],
22 error,
23 code(cxt: KeywordCxt) {
24 const {gen, schema, data, it} = cxt
25 if (alwaysValidSchema(it, schema)) return
26 const valid = gen.name("valid")
27
28 gen.forIn("key", data, (key) => {
29 cxt.setParams({propertyName: key})
30 cxt.subschema(
31 {
32 keyword: "propertyNames",
33 data: key,
34 dataTypes: ["string"],
35 propertyName: key,
36 compositeRule: true,
37 },
38 valid
39 )
40 gen.if(not(valid), () => {
41 cxt.error(true)
42 if (!it.allErrors) gen.break()
43 })
44 })
45
46 cxt.ok(valid)
47 },
48}
49
50export default def

Callers

nothing calls this directly

Calls 10

alwaysValidSchemaFunction · 0.90
notFunction · 0.90
forInMethod · 0.80
setParamsMethod · 0.80
subschemaMethod · 0.80
ifMethod · 0.80
breakMethod · 0.80
okMethod · 0.80
errorMethod · 0.65
nameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…