hrms-report-template/libs/create-swagger-spec.ts

37 lines
998 B
TypeScript
Raw Normal View History

// https://swagger.io/docs/specification/about/
import swaggerJsdoc from "swagger-jsdoc"
import fs from 'fs'
const swaggerOptions = {
definition: {
openapi: "3.1.0",
info: {
title: "Report Server",
version: "0.1.0",
description:
"Advance Create and convert document API for microservice.",
license: {
name: "by Frappet",
url: "https://frappet.com",
},
},
servers: [
{
url: "https://report-server.frappet.synology.me",
},
{
url: "http://localhost:3000",
},
{
url: "http://192.168.2.100:3000",
},
],
},
apis: ["./libs/*.ts"],
};
export function createSpec(){
const swaggerSpecs = swaggerJsdoc(swaggerOptions);
fs.promises.writeFile("libs/swagger-specs.json",JSON.stringify(swaggerSpecs,null,2))
}
createSpec()