Work towards fixing openapi spec
This commit is contained in:
+9
-7
@@ -85,13 +85,15 @@ function apiRoutes() {
|
||||
.map((x) => ({ name: x }));
|
||||
|
||||
specification.components = specification.components || {};
|
||||
specification.components.securitySchemes = {
|
||||
bearer: {
|
||||
type: "http",
|
||||
scheme: "bearer",
|
||||
description: "Bearer/Bot prefixes are not required.",
|
||||
specification.components.securitySchemes = [
|
||||
{
|
||||
bearer: {
|
||||
type: "http",
|
||||
scheme: "bearer",
|
||||
description: "Bearer/Bot prefixes are not required.",
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
||||
routes.forEach((route, pathAndMethod) => {
|
||||
const [p, method] = pathAndMethod.split("|");
|
||||
@@ -109,7 +111,7 @@ function apiRoutes() {
|
||||
return x.test(path);
|
||||
})
|
||||
) {
|
||||
obj.security = [{ bearer: true }];
|
||||
obj.security = [{ bearer: [] }];
|
||||
}
|
||||
|
||||
if (route.body) {
|
||||
|
||||
+28
-6
@@ -91,9 +91,9 @@ function main() {
|
||||
if (!part) continue;
|
||||
|
||||
// this is a hack. want some want to check if its a @column, instead
|
||||
if (part.properties)
|
||||
Object.keys(part.properties)
|
||||
.filter((key) =>
|
||||
if (part.properties) {
|
||||
for (let key in part.properties) {
|
||||
if (
|
||||
[
|
||||
// BaseClass methods
|
||||
"toJSON",
|
||||
@@ -104,9 +104,31 @@ function main() {
|
||||
"recover",
|
||||
"reload",
|
||||
"assign",
|
||||
].includes(key),
|
||||
)
|
||||
.forEach((key) => delete part.properties[key]);
|
||||
].includes(key)
|
||||
) {
|
||||
delete part.properties[key];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (part.properties[key].anyOf) {
|
||||
const nullIndex = part.properties[key].anyOf.findIndex(
|
||||
(x) => x.type == "null",
|
||||
);
|
||||
if (nullIndex != -1) {
|
||||
part.properties[key].nullable = true;
|
||||
part.properties[key].anyOf.splice(nullIndex, 1);
|
||||
|
||||
if (part.properties[key].anyOf.length == 1) {
|
||||
Object.assign(
|
||||
part.properties[key],
|
||||
part.properties[key].anyOf[0],
|
||||
);
|
||||
delete part.properties[key].anyOf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
definitions = { ...definitions, [name]: { ...part } };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user