OpenAPI: Fix absolute path when input is string/array

This commit is contained in:
Fuma Nama
2025-08-21 14:56:39 +08:00
parent 103068043f
commit 2122783b7a
2 changed files with 11 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---
Fix absolute path when `input` is string/array
+6 -6
View File
@@ -126,18 +126,18 @@ export async function generateFiles(options: Config): Promise<void> {
if (Array.isArray(input)) {
const targets: string[] = [];
const patterns: string[] = [];
for (const item of input) {
if (isUrl(item)) {
targets.push(item);
} else {
targets.push(...(await glob(item, { cwd, absolute: true })));
}
if (isUrl(item)) targets.push(item);
else patterns.push(item);
}
if (patterns.length > 0) targets.push(...(await glob(patterns, { cwd })));
await Promise.all(
targets.map(async (item) => {
schemas[item] = await processDocument(item);
schemas[item] = await processDocument(path.join(cwd, item));
}),
);
} else {