Home / Function/ setValidatorCompiler() — fastify Function Reference

setValidatorCompiler() — fastify Function Reference

Architecture documentation for the setValidatorCompiler() function in schema-controller.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  6d12cc56_c152_f74b_d8a6_1702f23f0b36["setValidatorCompiler()"]
  f9c71bed_770a_87b0_8d4c_3279f23ba910["SchemaController"]
  6d12cc56_c152_f74b_d8a6_1702f23f0b36 -->|defined in| f9c71bed_770a_87b0_8d4c_3279f23ba910
  style 6d12cc56_c152_f74b_d8a6_1702f23f0b36 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/schema-controller.js lines 75–95

  setValidatorCompiler (validatorCompiler) {
    // Set up as if the fixed validator compiler had been provided
    // by a custom 'options.compilersFactory.buildValidator' that
    // always returns the same compiler object. This is required because:
    //
    // - setValidatorCompiler must immediately install a compiler to preserve
    //   legacy behavior
    // - setupValidator will recreate compilers from builders in some
    //   circumstances, so we have to install this adapter to make it
    //   behave the same if the legacy API is used
    //
    // The cloning of the compilersFactory object is necessary because
    // we are aliasing the parent compilersFactory if none was provided
    // to us (see constructor.)
    this.compilersFactory = Object.assign(
      {},
      this.compilersFactory,
      { buildValidator: () => validatorCompiler })
    this.validatorCompiler = validatorCompiler
    this.isCustomValidatorCompiler = true
  }

Domain

Subdomains

Frequently Asked Questions

What does setValidatorCompiler() do?
setValidatorCompiler() is a function in the fastify codebase, defined in lib/schema-controller.js.
Where is setValidatorCompiler() defined?
setValidatorCompiler() is defined in lib/schema-controller.js at line 75.

Analyze Your Own Codebase

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

Try Supermodel Free