mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
OpenAPI: Fix absolute path when input is string/array
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-openapi': patch
|
||||
---
|
||||
|
||||
Fix absolute path when `input` is string/array
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user