From 2ebe2a57fbbe177512b77b0ca6b8cca6aec858c6 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sat, 29 Nov 2025 22:22:41 +0100 Subject: Cut down schemas by 90% --- scripts/openapi.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts/openapi.js') diff --git a/scripts/openapi.js b/scripts/openapi.js index a1188c54..ab7de525 100644 --- a/scripts/openapi.js +++ b/scripts/openapi.js @@ -16,6 +16,9 @@ along with this program. If not, see . */ +const { Stopwatch } = require("../dist/util/util/Stopwatch"); +const totalSw = Stopwatch.startNew(); + require("module-alias/register"); const getRouteDescriptions = require("./util/getRouteDescriptions"); const path = require("path"); @@ -83,7 +86,7 @@ function combineSchemas(schemas) { for (const key in definitions) { if (!schemaRegEx.test(key)) { - console.error(`${bgRedBright("ERROR")} Invalid schema name: ${key}, context:`, definitions[key]); + console.error(` \x1b[5m${bgRedBright("ERROR")}\x1b[25m Invalid schema name: ${key}, context:`, definitions[key]); continue; } specification.components = specification.components || {}; @@ -240,7 +243,7 @@ async function main() { fs.writeFileSync(openapiPath, JSON.stringify(specification, null, 4).replaceAll("#/definitions", "#/components/schemas").replaceAll("bigint", "number")); console.log("Wrote OpenAPI specification to", openapiPath); - console.log("Specification contains", Object.keys(specification.paths).length, "paths and", Object.keys(specification.components.schemas).length, "schemas."); + console.log("Specification contains", Object.keys(specification.paths).length, "paths and", Object.keys(specification.components.schemas).length, "schemas in", Number(totalSw.elapsed().totalMilliseconds + "." + totalSw.elapsed().microseconds), "ms."); } main(); -- cgit 1.5.1