MCPcopy
hub / github.com/fastify/fastify / validatorCompiler

Function validatorCompiler

test/route.3.test.js:11–23  ·  view source on GitHub ↗
({ schema, method, url, httpPart })

Source from the content-addressed store, hash-verified

9
10 const fastify = Fastify()
11 function validatorCompiler ({ schema, method, url, httpPart }) {
12 // Needed to extract the params part,
13 // without the JSON-schema encapsulation
14 // that is automatically added by the short
15 // form of params.
16 schema = joi.object(schema.properties)
17
18 return validateHttpData
19
20 function validateHttpData (data) {
21 return schema.validate(data)
22 }
23 }
24
25 fastify.setValidatorCompiler(validatorCompiler)
26

Callers 1

request.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected