summary refs log tree commit diff
path: root/scripts/openapi.js
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-11-29 22:22:41 +0100
committerRory& <root@rory.gay>2025-11-29 22:22:41 +0100
commit2ebe2a57fbbe177512b77b0ca6b8cca6aec858c6 (patch)
treef2f7fa54bb09d219d72b3f546aa6360801d47480 /scripts/openapi.js
parentMerge pull request #1411 from MathMan05/status (diff)
downloadserver-ts-2ebe2a57fbbe177512b77b0ca6b8cca6aec858c6.tar.xz
Cut down schemas by 90%
Diffstat (limited to 'scripts/openapi.js')
-rw-r--r--scripts/openapi.js7
1 files changed, 5 insertions, 2 deletions
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 <https://www.gnu.org/licenses/>. */ +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();