import swaggerJsdoc from "swagger-jsdoc";
/**
* Swagger configuration for API documentation
* @category Config
*/
const swaggerOptions = {
definition: {
openapi: "3.0.0",
info: {
title: "K12 Backend Core API",
version: "1.0.0",
description: `
API documentation for K12 Backend Core - Investigation Management System
## Authentication
This API uses JWT Bearer token authentication. To authorize your requests:
1. Click the **"Authorize"** button (🔓) at the top right of this page
2. Enter your JWT token (just the token, no "Bearer" prefix needed)
3. Click **"Authorize"** to save it
4. Click **"Close"**
All protected endpoints will automatically include your token in requests.
`,
contact: {
name: "K12 Backend Team",
},
},
servers: [
{
url: "/",
description: "Current server (works with any deployment URL)",
},
],
components: {
securitySchemes: {
bearerAuth: {
type: "http",
scheme: "bearer",
bearerFormat: "JWT",
description: "Enter your JWT token (without 'Bearer' prefix - it will be added automatically)",
},
},
},
security: [
{
bearerAuth: [],
},
],
},
apis: [
"./src/docs/**/*.yaml",
"./src/docs/**/*.yml",
"./dist/docs/**/*.yaml",
"./dist/docs/**/*.yml",
],
};
export const swaggerSpec = swaggerJsdoc(swaggerOptions);
Source