MCPcopy
hub / github.com/fastify/fastify / schemaPlugin

Function schemaPlugin

test/schema-special-usage.test.js:395–419  ·  view source on GitHub ↗
(server)

Source from the content-addressed store, hash-verified

393 })
394
395 async function schemaPlugin (server) {
396 server.setSchemaController({
397 bucket () {
398 t.assert.ok('the bucket is created')
399 return {
400 addSchema (source) {
401 ajvInstance.addSchema(source)
402 },
403 getSchema (id) {
404 return ajvInstance.getSchema(id).schema
405 },
406 getSchemas () {
407 return {
408 'urn:schema:base': baseSchema,
409 'urn:schema:ref': refSchema
410 }
411 }
412 }
413 }
414 })
415 server.setValidatorCompiler(function ({ schema }) {
416 t.assert.ok('the querystring schema is compiled')
417 return ajvInstance.compile(schema)
418 })
419 }
420 schemaPlugin[Symbol.for('skip-override')] = true
421})
422

Callers

nothing calls this directly

Calls 3

setSchemaControllerMethod · 0.80
setValidatorCompilerMethod · 0.65
getSchemaMethod · 0.65

Tested by

no test coverage detected