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
Is there an existing issue that is already proposing this?
I have searched the existing issues
Is your feature request related to a problem? Please describe it
I want to integrate swagger files more tightly in my application. One case is to use custom authentication (guards) to restrict access to the generated resources. This would be possible with a dedicated SwaggerService. This service would provide access to all resources (like html file, openapi spec), but can be used more granular.
Create an injectable service like SwaggerService that can be used to get a readable stream / buffer of each generated resources by the swagger module.
Provide an option to disable automatic registration of routes for swagger resources when instantiating the SwaggerModule.
After you've create the document with SwaggerModule.createDocument() it can be consumed like any other OpenAPI spec document. The elegance of SwaggerModule.setup() is it configures the static asset server and creates the endpoints for you. The downside is that they are public endpoints; not sure if you can directly pass a spec object to the swagger-ui, the examples show loading it from a url.
I find ReDoc easier to navigate and customize, it's also dead simple to serve, pull it from their CDN and pass in the stringified spec document.
Quick POC to replicate SwaggerModule.setup(), from here it's fairly simple to move this to a service.
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I want to integrate swagger files more tightly in my application. One case is to use custom authentication (guards) to restrict access to the generated resources. This would be possible with a dedicated
SwaggerService
. This service would provide access to all resources (like html file, openapi spec), but can be used more granular.Example:
Describe the solution you'd like
Create an injectable service like
SwaggerService
that can be used to get a readable stream / buffer of each generated resources by the swagger module.Provide an option to disable automatic registration of routes for swagger resources when instantiating the
SwaggerModule
.Maybe more features I did not think of.
Drawbacks:
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
express-basic-auth
(as discussed here auth protect for swagger access url #244)The text was updated successfully, but these errors were encountered: