validateParam() — fastify Function Reference
Architecture documentation for the validateParam() function in validation.js from the fastify codebase.
Entity Profile
Dependency Diagram
graph TD 4340bc1c_3ec7_7049_554d_4377b3a311e0["validateParam()"] 7c105413_01f0_7169_1c95_0f84d089bea5["validation.js"] 4340bc1c_3ec7_7049_554d_4377b3a311e0 -->|defined in| 7c105413_01f0_7169_1c95_0f84d089bea5 208b6483_5f1a_738c_a527_eb1057e24926["validate()"] 208b6483_5f1a_738c_a527_eb1057e24926 -->|calls| 4340bc1c_3ec7_7049_554d_4377b3a311e0 style 4340bc1c_3ec7_7049_554d_4377b3a311e0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
lib/validation.js lines 118–144
function validateParam (validatorFunction, request, paramName) {
const isUndefined = request[paramName] === undefined
let ret
try {
ret = validatorFunction?.(isUndefined ? null : request[paramName])
} catch (err) {
// If validator throws synchronously, ensure it propagates as an internal error
err.statusCode = 500
return err
}
if (ret && typeof ret.then === 'function') {
return ret
.then((res) => { return answer(res) })
.catch(err => { return err }) // return as simple error (not throw)
}
return answer(ret)
function answer (ret) {
if (ret === false) return validatorFunction.errors
if (ret && ret.error) return ret.error
if (ret && ret.value) request[paramName] = ret.value
return false
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does validateParam() do?
validateParam() is a function in the fastify codebase, defined in lib/validation.js.
Where is validateParam() defined?
validateParam() is defined in lib/validation.js at line 118.
What calls validateParam()?
validateParam() is called by 1 function(s): validate.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free