compileSerializationSchema() — fastify Function Reference
Architecture documentation for the compileSerializationSchema() function in reply.js from the fastify codebase.
Entity Profile
Dependency Diagram
graph TD 89249428_ed5b_6713_ea5a_4045befd0d35["compileSerializationSchema()"] 4bcd71dc_1ec2_5fe8_b8ff_4a371e392925["reply.js"] 89249428_ed5b_6713_ea5a_4045befd0d35 -->|defined in| 4bcd71dc_1ec2_5fe8_b8ff_4a371e392925 2142f433_1d66_ceb5_1102_19519632e0ad["serializeInput()"] 2142f433_1d66_ceb5_1102_19519632e0ad -->|calls| 89249428_ed5b_6713_ea5a_4045befd0d35 style 89249428_ed5b_6713_ea5a_4045befd0d35 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
lib/reply.js lines 341–379
Reply.prototype.compileSerializationSchema = function (schema, httpStatus = null, contentType = null) {
const { request } = this
const { method, url } = request
// Check if serialize function already compiled
if (this[kRouteContext][kReplyCacheSerializeFns]?.has(schema)) {
return this[kRouteContext][kReplyCacheSerializeFns].get(schema)
}
const serializerCompiler = this[kRouteContext].serializerCompiler ||
this.server[kSchemaController].serializerCompiler ||
(
// We compile the schemas if no custom serializerCompiler is provided
// nor set
this.server[kSchemaController].setupSerializer(this.server[kOptions]) ||
this.server[kSchemaController].serializerCompiler
)
const serializeFn = serializerCompiler({
schema,
method,
url,
httpStatus,
contentType
})
// We create a WeakMap to compile the schema only once
// Its done lazily to avoid add overhead by creating the WeakMap
// if it is not used
// TODO: Explore a central cache for all the schemas shared across
// encapsulated contexts
if (this[kRouteContext][kReplyCacheSerializeFns] == null) {
this[kRouteContext][kReplyCacheSerializeFns] = new WeakMap()
}
this[kRouteContext][kReplyCacheSerializeFns].set(schema, serializeFn)
return serializeFn
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does compileSerializationSchema() do?
compileSerializationSchema() is a function in the fastify codebase, defined in lib/reply.js.
Where is compileSerializationSchema() defined?
compileSerializationSchema() is defined in lib/reply.js at line 341.
What calls compileSerializationSchema()?
compileSerializationSchema() is called by 1 function(s): serializeInput.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free