Highlight sb-only routes
This commit is contained in:
parent
0d6cb63096
commit
d1fe291418
Binary file not shown.
@ -114,7 +114,7 @@ function getTag(key) {
|
|||||||
return key.match(/\/([\w-]+)/)[1];
|
return key.match(/\/([\w-]+)/)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function apiRoutes() {
|
function apiRoutes(missingRoutes) {
|
||||||
const routes = getRouteDescriptions();
|
const routes = getRouteDescriptions();
|
||||||
|
|
||||||
// populate tags
|
// populate tags
|
||||||
@ -214,6 +214,15 @@ function apiRoutes() {
|
|||||||
|
|
||||||
obj.tags = [...(obj.tags || []), getTag(p)].unique();
|
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] = Object.assign(
|
||||||
specification.paths[path] || {},
|
specification.paths[path] || {},
|
||||||
{
|
{
|
||||||
@ -223,10 +232,21 @@ function apiRoutes() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
async function main() {
|
||||||
console.log("Generating OpenAPI Specification...");
|
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);
|
combineSchemas(schemas);
|
||||||
apiRoutes();
|
apiRoutes(missingRoutes);
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
openapiPath,
|
openapiPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user