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

Function addAsyncFormatsAndKeywords

spec/async_schemas.spec.ts:26–56  ·  view source on GitHub ↗
(ajv: Ajv)

Source from the content-addressed store, hash-verified

24})
25
26function addAsyncFormatsAndKeywords(ajv: Ajv) {
27 ajv.addFormat("date", /^\d\d\d\d-[0-1]\d-[0-3]\d$/)
28
29 ajv.addFormat("english_word", {
30 async: true,
31 validate: checkWordOnServer,
32 })
33
34 ajv.addKeyword({
35 keyword: "idExists",
36 async: true,
37 type: "number",
38 validate: checkIdExists,
39 errors: false,
40 })
41
42 ajv.addKeyword({
43 keyword: "idExistsWithError",
44 async: true,
45 type: "number",
46 validate: checkIdExistsWithError,
47 errors: true,
48 })
49
50 ajv.addKeyword({
51 keyword: "idExistsCompiled",
52 async: true,
53 type: "number",
54 compile: compileCheckIdExists,
55 })
56}
57
58function checkWordOnServer(str: string): Promise<boolean> {
59 return str === "tomorrow"

Callers

nothing calls this directly

Calls 2

addFormatMethod · 0.80
addKeywordMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…