This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
api/src/tools/configurations/swaggerOptions.ts

39 lines
849 B
TypeScript

import dotenv from 'dotenv'
import { readPackage } from 'read-pkg'
import type { FastifyDynamicSwaggerOptions } from '@fastify/swagger'
dotenv.config()
const packageJSON = await readPackage()
export const swaggerOptions: FastifyDynamicSwaggerOptions = {
routePrefix: '/documentation',
openapi: {
info: {
title: packageJSON.name,
description: packageJSON.description,
version: packageJSON.version
},
tags: [
{ name: 'users' },
{ name: 'oauth2' },
{ name: 'guilds' },
{ name: 'channels' },
{ name: 'messages' },
{ name: 'members' }
],
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT'
}
}
}
},
exposeRoute: true,
staticCSP: true,
hideUntagged: true
}