schema-validation.test.js — fastify Source File
Architecture documentation for schema-validation.test.js, a javascript file in the fastify codebase.
Entity Profile
Relationship Graph
Source Code
'use strict'
const { test } = require('node:test')
const Fastify = require('..')
const AJV = require('ajv')
const Schema = require('fluent-json-schema')
const { waitForCb } = require('./toolkit')
const customSchemaCompilers = {
body: new AJV({
coerceTypes: false
}),
params: new AJV({
coerceTypes: true
}),
querystring: new AJV({
coerceTypes: true
})
}
const customValidatorCompiler = req => {
if (!req.httpPart) {
throw new Error('Missing httpPart')
}
const compiler = customSchemaCompilers[req.httpPart]
if (!compiler) {
throw new Error(`Missing compiler for ${req.httpPart}`)
}
return compiler.compile(req.schema)
}
const schemaA = {
$id: 'urn:schema:foo',
type: 'object',
definitions: {
foo: { type: 'integer' }
},
properties: {
foo: { $ref: '#/definitions/foo' }
}
}
const schemaBRefToA = {
$id: 'urn:schema:response',
type: 'object',
required: ['foo'],
properties: {
foo: { $ref: 'urn:schema:foo#/definitions/foo' }
}
}
const schemaCRefToB = {
$id: 'urn:schema:request',
type: 'object',
required: ['foo'],
properties: {
foo: { $ref: 'urn:schema:response#/properties/foo' }
// ... (1513 more lines)
Domain
Subdomains
Functions
Classes
Source
Frequently Asked Questions
What does schema-validation.test.js do?
schema-validation.test.js is a source file in the fastify codebase, written in javascript. It belongs to the CoreKernel domain, LifecycleManager subdomain.
What functions are defined in schema-validation.test.js?
schema-validation.test.js defines 1 function(s): customValidatorCompiler.
Where is schema-validation.test.js in the architecture?
schema-validation.test.js is located at test/schema-validation.test.js (domain: CoreKernel, subdomain: LifecycleManager, directory: test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free