Home / Function/ validate() — fastify Function Reference

validate() — fastify Function Reference

Architecture documentation for the validate() function in hooks.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  05ec598d_d1b7_fedc_37cf_af22aa69e47d["validate()"]
  57bfad3b_e85a_1ebf_2702_a13bb6484083["hooks.js"]
  05ec598d_d1b7_fedc_37cf_af22aa69e47d -->|defined in| 57bfad3b_e85a_1ebf_2702_a13bb6484083
  0753fd7c_45bc_ed63_bfd4_f77ec043dda3["add()"]
  0753fd7c_45bc_ed63_bfd4_f77ec043dda3 -->|calls| 05ec598d_d1b7_fedc_37cf_af22aa69e47d
  style 05ec598d_d1b7_fedc_37cf_af22aa69e47d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/hooks.js lines 60–66

Hooks.prototype.validate = function (hook, fn) {
  if (typeof hook !== 'string') throw new FST_ERR_HOOK_INVALID_TYPE()
  if (Array.isArray(this[hook]) === false) {
    throw new FST_ERR_HOOK_NOT_SUPPORTED(hook)
  }
  if (typeof fn !== 'function') throw new FST_ERR_HOOK_INVALID_HANDLER(hook, Object.prototype.toString.call(fn))
}

Domain

Subdomains

Defined In

Called By

Frequently Asked Questions

What does validate() do?
validate() is a function in the fastify codebase, defined in lib/hooks.js.
Where is validate() defined?
validate() is defined in lib/hooks.js at line 60.
What calls validate()?
validate() is called by 1 function(s): add.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free