MCPcopy Create free account
hub / github.com/fastify/fastify / schemaValidator

Function schemaValidator

test/internals/handle-request.test.js:14–23  ·  view source on GitHub ↗
({ schema, method, url, httpPart })

Source from the content-addressed store, hash-verified

12const ajv = new Ajv({ coerceTypes: true })
13
14function schemaValidator ({ schema, method, url, httpPart }) {
15 const validateFunction = ajv.compile(schema)
16 const fn = function (body) {
17 const isOk = validateFunction(body)
18 if (isOk) return
19 return false
20 }
21 fn.errors = []
22 return fn
23}
24
25test('handleRequest function - sent reply', t => {
26 t.plan(1)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected