Skip to content

fix: correct isCustomSerializerCompiler flag check - #6657

Merged
mcollina merged 2 commits into
fastify:mainfrom
eddieran:fix/schema-controller-serializer-flag
Apr 20, 2026
Merged

mcollina merged 2 commits into
fastify:mainfrom
eddieran:fix/schema-controller-serializer-flag

Conversation

@eddieran

Copy link
Copy Markdown
Contributor

Summary

Fixes #6652. This replaces PR #6655 which was accidentally closed.

The isCustomSerializerCompiler flag in lib/schema-controller.js was incorrectly checking opts?.compilersFactory?.buildValidator instead of opts?.compilersFactory?.buildSerializer. This caused the flag to always mirror isCustomValidatorCompiler rather than independently tracking whether a custom serializer compiler was provided.

Changes

  • lib/schema-controller.js: Changed the isCustomSerializerCompiler initialization to check buildSerializer instead of buildValidator
  • test/internals/schema-controller-perf.test.js: Added two test cases verifying that isCustomSerializerCompiler and isCustomValidatorCompiler are set independently based on which compiler factory functions are provided

The isCustomSerializerCompiler flag was incorrectly checking
opts.compilersFactory.buildValidator instead of
opts.compilersFactory.buildSerializer, causing the flag to
mirror isCustomValidatorCompiler rather than reflecting
whether a custom serializer compiler was actually provided.

Fixes: fastify#6652
Comment thread test/internals/schema-controller-perf.test.js
@mcollina
mcollina merged commit d76dbcd into fastify:main Apr 20, 2026
32 checks passed
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Schema controller checks buildValidator instead of buildSerializer for isCustomSerializerCompiler

5 participants