Skip to content

refactor(types)!: remove deprecated FastifyPlugin type - #6897

Merged
climba03003 merged 4 commits into
fastify:nextfrom
Tony133:refactor/remove-deprecated-fastify-plugin
Aug 4, 2026
Merged

climba03003 merged 4 commits into
fastify:nextfrom
Tony133:refactor/remove-deprecated-fastify-plugin

Conversation

@Tony133

@Tony133 Tony133 commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Proposal:

  • This PR removes the deprecated FastifyPlugin TypeScript definition and its related type assertions. FastifyPlugin was previously marked as @deprecated, the users should explicitly use FastifyPluginCallback or FastifyPluginAsync instead. ( see screenshot )

Changes:

  • Core Types: Removed FastifyPlugin type definition from types/plugin.d.ts and its exports/imports from fastify.d.ts.
  • Documentation: Cleaned up references to FastifyPlugin in docs/Reference/TypeScript.md and docs/Reference/Getting-Started.md.
  • Cleaned up type tests in test/types/fastify.tst.ts.

Screenshot:

deprecated

@Tony133
Tony133 force-pushed the refactor/remove-deprecated-fastify-plugin branch from b8303f6 to f6e7420 Compare August 2, 2026 14:14
@Tony133 Tony133 changed the title refactor(types): remove deprecated FastifyPlugin type refactor(test-types): remove deprecated FastifyPlugin type Aug 2, 2026
@Tony133 Tony133 changed the title refactor(test-types): remove deprecated FastifyPlugin type refactor(types): remove deprecated FastifyPlugin type Aug 2, 2026
@Tony133
Tony133 marked this pull request as ready for review August 2, 2026 14:19
@Tony133
Tony133 requested a review from a team August 2, 2026 14:20
fastify#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 fastify#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
@Tony133
Tony133 force-pushed the refactor/remove-deprecated-fastify-plugin branch from f6e7420 to c5e58c8 Compare August 2, 2026 20:25

@jean-michelet jean-michelet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is more references of this type in core:

Image

@Tony133
Tony133 force-pushed the refactor/remove-deprecated-fastify-plugin branch from c5e58c8 to 5553c3e Compare August 2, 2026 20:59
@github-actions github-actions Bot added documentation Improvements or additions to documentation typescript TypeScript related labels Aug 2, 2026
@Tony133
Tony133 force-pushed the refactor/remove-deprecated-fastify-plugin branch from 5553c3e to 3b0d058 Compare August 2, 2026 21:09
Removed the deprecated FastifyPlugin type export and its corresponding test definitions. Users should use FastifyPluginAsync or FastifyPluginCallback instead.
@Tony133
Tony133 force-pushed the refactor/remove-deprecated-fastify-plugin branch from 3b0d058 to 599dcd0 Compare August 2, 2026 21:20

@climba03003 climba03003 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove of deprecation should target on next branch.
We cannot release breaking change on main branch.

@jean-michelet

Copy link
Copy Markdown
Member

I think we should clarify what practices we follow regarding ts versioning:
#6308 (comment)

I am a bit lost, in practice, ts team doesn't even follow semver, but they consider breaking changes.

next target the next minor?

@climba03003

Copy link
Copy Markdown
Member

next target the next minor?

Next major.

I think we should clarify what practices we follow regarding ts versioning: #6308 (comment)

Bugfix breaking changes is determine by how large it affect and if it is beneficial to provide such fix.
Deprecation always follow the semver, there is no rush to break people for deprecating something.

@Tony133 Tony133 added this to the v6.0.0 milestone Aug 3, 2026
@Tony133

Tony133 commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

I added the tag for milestone v6.0.0, I don't have permission to switch to the “next” branch.

@Tony133 Tony133 changed the title refactor(types): remove deprecated FastifyPlugin type refactor(types)!: remove deprecated FastifyPlugin type Aug 3, 2026
@climba03003
climba03003 changed the base branch from main to next August 3, 2026 08:14
@climba03003
climba03003 merged commit 1d1cf69 into fastify:next Aug 4, 2026
41 checks passed
@Tony133
Tony133 deleted the refactor/remove-deprecated-fastify-plugin branch August 4, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation typescript TypeScript related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants