mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
OpenAPI: Support adding description to generated document body
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-openapi': patch
|
||||
---
|
||||
|
||||
Support adding `description` to generated document body
|
||||
@@ -51,6 +51,13 @@ export interface GenerateOptions {
|
||||
context: DocumentContext,
|
||||
) => Record<string, unknown>;
|
||||
|
||||
/**
|
||||
* Add description to document body
|
||||
*
|
||||
* @defaultValue false
|
||||
*/
|
||||
includeDescription?: boolean;
|
||||
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export function generateDocument(
|
||||
context: DocumentContext;
|
||||
},
|
||||
): string {
|
||||
const { frontmatter } = options;
|
||||
const { frontmatter, includeDescription = false } = options;
|
||||
const out: string[] = [];
|
||||
const extend = frontmatter?.(
|
||||
options.title,
|
||||
@@ -64,6 +64,8 @@ export function generateDocument(
|
||||
out.push(imports);
|
||||
}
|
||||
|
||||
if (options.description && includeDescription) out.push(options.description);
|
||||
|
||||
out.push(pageContent(options.page));
|
||||
|
||||
return out.join('\n\n');
|
||||
|
||||
Reference in New Issue
Block a user