summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorTomatoCake <60300461+DEVTomatoCake@users.noreply.github.com>2024-08-21 19:19:33 +0200
committerTomatoCake <60300461+DEVTomatoCake@users.noreply.github.com>2024-08-21 19:19:33 +0200
commitd1fe2914180c4d03537f8bd0b77190366296c7e0 (patch)
treed4c55beeaf224e762520697b9fe591f776547cd3 /scripts
parentSlight code cleanup & update project desc (diff)
downloadserver-ts-d1fe2914180c4d03537f8bd0b77190366296c7e0.tar.xz
Highlight sb-only routes
Diffstat (limited to 'scripts')
-rw-r--r--scripts/openapi.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/scripts/openapi.js b/scripts/openapi.js

index 225c5175..62623800 100644 --- a/scripts/openapi.js +++ b/scripts/openapi.js
@@ -114,7 +114,7 @@ function getTag(key) { return key.match(/\/([\w-]+)/)[1]; } -function apiRoutes() { +function apiRoutes(missingRoutes) { const routes = getRouteDescriptions(); // populate tags @@ -214,6 +214,15 @@ function apiRoutes() { obj.tags = [...(obj.tags || []), getTag(p)].unique(); + if (missingRoutes.additional.includes(path.replace(/\/$/, ""))) { + obj["x-badges"] = [ + { + label: "Spacebar-only", + color: "red", + }, + ]; + } + specification.paths[path] = Object.assign( specification.paths[path] || {}, { @@ -223,10 +232,21 @@ function apiRoutes() { }); } -function main() { +async function main() { console.log("Generating OpenAPI Specification..."); + + const routesRes = await fetch( + "https://github.com/spacebarchat/missing-routes/raw/main/missing.json", + { + headers: { + Accept: "application/json", + }, + }, + ); + const missingRoutes = await routesRes.json(); + combineSchemas(schemas); - apiRoutes(); + apiRoutes(missingRoutes); fs.writeFileSync( openapiPath,