Home / Function/ buildSchemaController() — fastify Function Reference

buildSchemaController() — fastify Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a609ec8b_a8b2_4ae6_8557_77e998cfe50e["buildSchemaController()"]
  a2112e8b_4082_af50_d135_2032dc6e6889["schema-controller.js"]
  a609ec8b_a8b2_4ae6_8557_77e998cfe50e -->|defined in| a2112e8b_4082_af50_d135_2032dc6e6889
  style a609ec8b_a8b2_4ae6_8557_77e998cfe50e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/schema-controller.js lines 11–38

function buildSchemaController (parentSchemaCtrl, opts) {
  if (parentSchemaCtrl) {
    return new SchemaController(parentSchemaCtrl, opts)
  }

  const compilersFactory = Object.assign({
    buildValidator: null,
    buildSerializer: null
  }, opts?.compilersFactory)

  if (!compilersFactory.buildValidator) {
    const ValidatorSelector = require('@fastify/ajv-compiler')
    compilersFactory.buildValidator = ValidatorSelector()
  }
  if (!compilersFactory.buildSerializer) {
    const SerializerSelector = require('@fastify/fast-json-stringify-compiler')
    compilersFactory.buildSerializer = SerializerSelector()
  }

  const option = {
    bucket: (opts && opts.bucket) || buildSchemas,
    compilersFactory,
    isCustomValidatorCompiler: typeof opts?.compilersFactory?.buildValidator === 'function',
    isCustomSerializerCompiler: typeof opts?.compilersFactory?.buildValidator === 'function'
  }

  return new SchemaController(undefined, option)
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free