Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NestJs + Swagger documentation based on versioning

I have built a nestjs webapi and implemented versioning at controller and action level as per https://docs.nestjs.com/techniques/versioning

The solution i am looking into is, i want to generate 2 different swagger based on the controller version. For example, i have 2 controller defined for 2 different version. if i hit [example.com/v1/swagger] , it should load only v1 version controller swagger doc and similarly for v2

like image 326
Sathish Avatar asked May 14 '26 11:05

Sathish


1 Answers

app.enableVersioning(); should be called before SwaggerModule.createDocument(...)

Source: https://github.com/nestjs/swagger/issues/1495#issuecomment-898311614

like image 181
marnutux Avatar answered May 18 '26 02:05

marnutux



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!