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 use NestJs with the swagger module in a multi-tenant environment where each customer is a tenant.
All my API endpoints are prefixed with "/:customer/" using setGlobalPrefix.
I want all the requests made by the swagger UI prefixed with the current customer.
For example, if I go on /customer-1/docs, I want all the requests to start with /customer-1/.
I serve my swagger under /:customer/docs using SwaggerModule.setup('/:customer/docs', app, document,{useGlobalPrefix: false}).
In this setup, if I have a route /:customer/my-route, the swagger UI will target /my-route since the swagger module doesn't know there is a global prefix.
I want to be able to change the servers field of the OpenAPI document to add the /:customer part.
Describe the solution you'd like
To support this behaviour, we could pass a function called patchDocument that takes the request, response and document and return a patched document.
SwaggerModule.setup('/:customer/docs',app,document,{useGlobalPrefix: false,patchDocument: (req: Request,res: Response,document: OpenAPIObject): OpenAPIObject=>{// change document.servers based on req.params.customer// and return the patched document}});
What is the motivation / use case for changing the behavior?
In our multi-tenant environment, we want our customers to be isolated. Automatically patching the OpenAPI document based on the request allow us to not add the :customer path param to each request.
The text was updated successfully, but these errors were encountered:
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I use NestJs with the swagger module in a multi-tenant environment where each customer is a tenant.
All my API endpoints are prefixed with "/:customer/" using
setGlobalPrefix
.I want all the requests made by the swagger UI prefixed with the current customer.
For example, if I go on
/customer-1/docs
, I want all the requests to start with/customer-1/
.I serve my swagger under
/:customer/docs
usingSwaggerModule.setup('/:customer/docs', app, document,{useGlobalPrefix: false})
.In this setup, if I have a route
/:customer/my-route
, the swagger UI will target/my-route
since the swagger module doesn't know there is a global prefix.I want to be able to change the
servers
field of the OpenAPI document to add the/:customer
part.Describe the solution you'd like
To support this behaviour, we could pass a function called
patchDocument
that takes the request, response and document and return a patched document.Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
In our multi-tenant environment, we want our customers to be isolated. Automatically patching the OpenAPI document based on the request allow us to not add the
:customer
path param to each request.The text was updated successfully, but these errors were encountered: