feat(docs): internal API docs

This commit is contained in:
Elian Doran
2025-02-15 00:25:23 +02:00
parent 81d5d16e1a
commit 9299f90b85
4 changed files with 31 additions and 10 deletions
+6 -1
View File
@@ -29,7 +29,12 @@ const copy = async () => {
fs.copySync(path.join("build", srcFile), destFile, { recursive: true });
}
const filesToCopy = ["config-sample.ini", "tsconfig.webpack.json", "./src/etapi/etapi.openapi.yaml"];
const filesToCopy = [
"config-sample.ini",
"tsconfig.webpack.json",
"./src/etapi/etapi.openapi.yaml",
"./src/routes/api/openapi.json"
];
for (const file of filesToCopy) {
log(`Copying ${file}`);
await fs.copy(file, path.join(DEST_DIR, file));
+7 -2
View File
@@ -1,4 +1,7 @@
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import swaggerJsdoc from 'swagger-jsdoc';
import fs from "fs";
/*
* Usage: npm run generate-openapi | tail -n1 > x.json
@@ -33,8 +36,10 @@ const options = {
};
const openapiSpecification = swaggerJsdoc(options);
console.log(JSON.stringify(openapiSpecification));
const scriptDir = dirname(fileURLToPath(import.meta.url));
const outputPath = join(scriptDir, "..", "src", "routes", "api", "openapi.json");
fs.writeFileSync(outputPath, JSON.stringify(openapiSpecification));
console.log("Saved to ", outputPath);
/**
* @swagger