#5356·fastify

method to check if plugin version is matching the Fastify version

Author: matthykCreated Mar 12, 2024Updated Sep 17, 2026

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

Feature Proposal

If you register a plugin that does not match the Fastify version, an error is thrown. It would be helpful to have a function like 'checkPluginVersion' that follows the same logic to check if the given plugin version matches the Fastify version.

Motivation

No response

Example

javascript
import fp from 'fastify-plugin'
import Fastify from 'fastify'

const plugin = fp(async app => {}, {
  fastify: '4.x'
}) 

const app = Fastify()

if (app.checkPluginVersion(plugin)) {
  console.log('plugin version does match' )
} else {
  console.log('plugin version does not match' )
}