最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

nestjs - Disable expandcollapse controller's endpoints - Stack Overflow

programmeradmin1浏览0评论

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: . So I wonder if the expand/collapse all endpoints is an upgrade feature of @nestjs/swagger :)

发布评论

评论列表(0)

  1. 暂无评论