Repository navigation
fix(types): allow explicit http2: false in server options - #6888
Merged
Merged
Conversation
climba03003
approved these changes
Jul 31, 2026
Eomm
approved these changes
Aug 2, 2026
5 tasks done
climba03003
pushed a commit
that referenced
this pull request
Aug 4, 2026
* fix(types): allow explicit http2: false in server options (#6888) * docs: clarify what attachValidation exposes on request.validationError (#6891) * docs: clarify what attachValidation exposes on request.validationError The docs described `request.validationError` as carrying "the raw validation result", and the inline example pointed only at `.validation`. That wording implied the descriptive message had to be rebuilt by hand, which is what prompted #5235. `wrapValidationError()` in lib/validation.js runs `schemaErrorFormatter` and `validationCompleted()` in lib/handle-request.js assigns that same error to `request.validationError`. There is no raw-only path, so `.message` is identical to the message sent when `attachValidation` is unset. List the properties actually available (`message`, `validation`, `validationContext`, `code`, `statusCode`) and add a test pinning the equivalence between the attached and the default message. * test: improve validation error message assertions in attached validation test * refactor(types): remove deprecated FastifyPlugin type Removed the deprecated FastifyPlugin type export and its corresponding test definitions. Users should use FastifyPluginAsync or FastifyPluginCallback instead. * fix: update url --------- Co-authored-by: Tiziano Basile <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal:
Adds an optional
http2?: falseproperty toFastifyHttpOptionsandFastifyHttpsOptionsso that explicitly passinghttp2: falseno longer triggers a TypeScript error, matching the runtime behavior in lib/server.js which already falls back to http.createServer/https correctly when http2 is false.Adds type tests verifying that
fastify({ http2: false })resolves to an http1 instance andfastify({ https: {}, http2: false })resolves to an https instance, updated to the tstyche syntax used by the current test suite.Closes #5682 and replaces this PR: #6585, which is no longer up to date since it still uses
tsdfor type testing