OpenAPI: fix typescript schema generation

This commit is contained in:
Fuma Nama
2026-02-26 19:43:41 +08:00
parent 41ac2c67ed
commit 9013195080
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---
fix typescript schema generation
+2 -2
View File
@@ -12,8 +12,8 @@ export function createAPIPage(server: OpenAPIServer, options: CreateAPIPageOptio
...options,
shiki: configDefault,
generateTypeScriptSchema(method, statusCode, contentType, ctx) {
const schema = method.responses?.[statusCode]?.content?.[contentType];
if (!schema) return;
const schema = method.responses?.[statusCode]?.content?.[contentType].schema;
if (!schema || typeof schema !== 'object') return;
return getTypescriptSchema(schema, ctx);
},
});