You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.x.x
Plugin version
No response
Node.js version
20.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 22.04
Description
FastifyRequest.routeSchema might be undefined, for example if route does not exists. The type currently can't be trusted if you would try to access the schema within any hook.
I think the type here should be marked as optional
Prerequisites
Fastify version
4.x.x
Plugin version
No response
Node.js version
20.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 22.04
Description
FastifyRequest.routeSchema
might be undefined, for example if route does not exists. The type currently can't be trusted if you would try to access the schema within any hook.I think the type here should be marked as optional
fastify/types/request.d.ts
Line 67 in 4a35a5a
and same goes for schema in route options
fastify/types/request.d.ts
Line 34 in 4a35a5a
Steps to Reproduce
Set up fastify with a hook like
onRequest
and observe schema while calling a route that has no been defined.Expected Behavior
The type should correctly reflect runtime behavior
The text was updated successfully, but these errors were encountered: