OpenAPI: improve error messages

This commit is contained in:
Fuma Nama
2025-09-23 15:33:15 +08:00
parent 172bbdd3a5
commit 0bb67d33ac
3 changed files with 15 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---
Improve error message
@@ -49,7 +49,13 @@ export async function processDocument(
throw new Error(`Failed to resolve ${node.$ref}`);
},
},
}).then((v) => upgrade(v).specification);
})
.then((v) => upgrade(v).specification)
.catch((e) => {
throw new Error(`[OpenAPI] Failed to resolve input: ${input}`, {
cause: e,
});
});
/**
* Dereferenced value and its original `$ref` value
+3 -2
View File
@@ -200,8 +200,9 @@ function NavbarLinkItem({
if (item.type === 'menu') {
const children = item.items.map((child, j) => {
if (child.type === 'custom')
if (child.type === 'custom') {
return <Fragment key={j}>{child.children}</Fragment>;
}
const {
banner = child.icon ? (
@@ -214,7 +215,7 @@ function NavbarLinkItem({
return (
<NavbarMenuLink
key={j}
key={`${j}-${child.url}`}
href={child.url}
external={child.external}
{...rest}