1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-09 12:12:35 +01:00

Fix bug where different HTTP method handlers would overwrite eachother in spec generation

This commit is contained in:
Madeline 2023-04-14 15:17:30 +10:00
parent a8a28542f7
commit 029bc8b5f8
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
2 changed files with 2637 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@ -84,7 +84,7 @@ function combineSchemas(schemas) {
}
for (const key in definitions) {
const reg = new RegExp(/^[a-zA-Z0-9\.\-_]+$/, "gm");
const reg = new RegExp(/^[a-zA-Z0-9.\-_]+$/, "gm");
if (!reg.test(key)) {
console.error(`Invalid schema name: ${key} (${reg.test(key)})`);
continue;
@ -218,9 +218,12 @@ function apiRoutes() {
obj.tags = [...(obj.tags || []), getTag(p)].unique();
specification.paths[path] = {
[method]: obj,
};
specification.paths[path] = Object.assign(
specification.paths[path] || {},
{
[method]: obj,
},
);
});
}