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
Now, we're generating OpenAPI with fastify/swagger, and it becomes necessary to tell API consumers which routes have which kinds of authentication. The code knows which routes do and don't, and we can repeat this information in the route-specific schema, but it'd be lovely to be able to have routes with auth automatically get a schema.security value.
I don't know how this is possible - preHandler, probably not. Maybe like a plugin that operates on each route?
Is there a kind of abstraction that can both add a preHandler hook and affect a route's schema in this way?
The text was updated successfully, but these errors were encountered:
What are you trying to achieve, or the steps to reproduce?
We're using some very basic fastify.decorateRequest and fastify.decorate calls to support bearer auth in our application:
As an example. Then in each route, we use a
preHandler
to run this decorator:Now, we're generating OpenAPI with fastify/swagger, and it becomes necessary to tell API consumers which routes have which kinds of authentication. The code knows which routes do and don't, and we can repeat this information in the route-specific schema, but it'd be lovely to be able to have routes with auth automatically get a
schema.security
value.I don't know how this is possible - preHandler, probably not. Maybe like a plugin that operates on each route?
Is there a kind of abstraction that can both add a
preHandler
hook and affect a route's schema in this way?The text was updated successfully, but these errors were encountered: