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) { 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)) { if (!reg.test(key)) {
console.error(`Invalid schema name: ${key} (${reg.test(key)})`); console.error(`Invalid schema name: ${key} (${reg.test(key)})`);
continue; continue;
@ -218,9 +218,12 @@ function apiRoutes() {
obj.tags = [...(obj.tags || []), getTag(p)].unique(); obj.tags = [...(obj.tags || []), getTag(p)].unique();
specification.paths[path] = { specification.paths[path] = Object.assign(
specification.paths[path] || {},
{
[method]: obj, [method]: obj,
}; },
);
}); });
} }