input-validation.js — fastify Source File
Architecture documentation for input-validation.js, a javascript file in the fastify codebase.
Entity Profile
Relationship Graph
Source Code
'use strict'
const Ajv = require('ajv')
const Joi = require('joi')
const yup = require('yup')
const assert = require('node:assert')
module.exports.payloadMethod = function (method, t) {
const test = t.test
const fastify = require('..')()
const upMethod = method.toUpperCase()
const loMethod = method.toLowerCase()
const opts = {
schema: {
body: {
type: 'object',
properties: {
hello: {
type: 'integer'
}
}
}
}
}
const ajv = new Ajv({ coerceTypes: true, removeAdditional: true })
const optsWithCustomValidator = {
schema: {
body: {
type: 'object',
properties: {
hello: {
type: 'integer'
}
},
additionalProperties: false
}
},
validatorCompiler: function ({ schema, method, url, httpPart }) {
return ajv.compile(schema)
}
}
const optsWithJoiValidator = {
schema: {
body: Joi.object().keys({
hello: Joi.string().required()
}).required()
},
validatorCompiler: function ({ schema, method, url, httpPart }) {
return schema.validate.bind(schema)
}
}
const yupOptions = {
strict: true, // don't coerce
abortEarly: false, // return all errors
stripUnknown: true, // remove additional properties
recursive: true
// ... (276 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does input-validation.js do?
input-validation.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 input-validation.js?
input-validation.js defines 1 function(s): payloadMethod.
Where is input-validation.js in the architecture?
input-validation.js is located at test/input-validation.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