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

Function callValidateCode

lib/vocabularies/code.ts:75–91  ·  view source on GitHub ↗
(
  {schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt,
  func: Code,
  context: Code,
  passSchema?: boolean
)

Source from the content-addressed store, hash-verified

73}
74
75export function callValidateCode(
76 {schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt,
77 func: Code,
78 context: Code,
79 passSchema?: boolean
80): Code {
81 const dataAndSchema = passSchema ? _`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data
82 const valCxt: [Name, Code | number][] = [
83 [N.instancePath, strConcat(N.instancePath, errorPath)],
84 [N.parentData, it.parentData],
85 [N.parentDataProperty, it.parentDataProperty],
86 [N.rootData, N.rootData],
87 ]
88 if (it.opts.dynamicRef) valCxt.push([N.dynamicAnchors, N.dynamicAnchors])
89 const args = _`${dataAndSchema}, ${gen.object(...valCxt)}`
90 return context !== nil ? _`${func}.call(${context}, ${args})` : _`${func}(${args})`
91}
92
93const newRegExp = _`new RegExp`
94

Callers 3

callAsyncRefFunction · 0.90
callSyncRefFunction · 0.90
assignValidFunction · 0.90

Calls 3

_Function · 0.90
strConcatFunction · 0.90
objectMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…