Files
dzone-api/src/configs/swagger.config.ts
T
2026-02-17 09:19:11 +03:30

30 lines
815 B
TypeScript
Executable File

import { NestFastifyApplication } from "@nestjs/platform-fastify";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
export function getSwaggerDocument(app: NestFastifyApplication) {
const swaggerConfig = new DocumentBuilder()
.setTitle("The Danak dsc api document")
.setDescription("The Danak dsc API description")
.addBearerAuth(
{
type: "http",
scheme: "bearer",
bearerFormat: "JWT",
name: "authorization",
in: "header",
},
"authorization",
)
.setVersion("1.0.0")
.build();
const swaggerDocument = SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup("api-docs", app, swaggerDocument, {
swaggerOptions: {
docExpansion: "none",
defaultModelsExpandDepth: -1,
},
});
}