Reputation: 1
I'm new to NestJs and facing this problem while documenting my apis: when I click to preview an endpoint, all endpoints in that controller will auto expand/collapse, and my page will jump to the first endpoint in the current controller.
My config:
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.setGlobalPrefix("api");
app.enableCors();
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,
transform: true,
}),
);
const swaggerConfig = new DocumentBuilder()
.setTitle("Example API")
.setDescription("Example API description")
.setVersion("1.0")
.addBearerAuth()
.build();
const documentFactory = () =>
SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup("api", app, documentFactory);
await app.listen(config.PORT);
console.log(`Server is running on http://localhost:${config.PORT}/api`);
if (module.hot) {
module.hot.accept();
module.hot.dispose(() => app.close());
}
}
Does anyone have the same issue ?
This repo has older library version and it works without my issue: https://github.com/notiz-dev/nestjs-swagger. So I wonder if the expand/collapse all endpoints is an upgrade feature of @nestjs/swagger :)
Upvotes: 0
Views: 34