Skip to content

Commit e1e210e

Browse files
authored
feat: add showInfoPage option to disable info page generation (#1272)
- Add showInfoPage boolean option (default: true) to disable info page - Follows existing showSchemas pattern for consistency - Also documents schemasOnly as a config option (was CLI-only before) Closes #1103
1 parent 7740c82 commit e1e210e

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

demo/docusaurus.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ const config: Config = {
352352
groupPathsBy: "tag",
353353
},
354354
showSchemas: true,
355+
showInfoPage: false, // Disable info page generation
355356
} satisfies OpenApiPlugin.Options,
356357
tests: {
357358
specPath: "examples/tests",

packages/docusaurus-plugin-openapi-docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following
176176
| `versions` | `object` | `null` | _Optional:_ Options for versioning configuration. See below for a list of supported options. |
177177
| `markdownGenerators` | `object` | `null` | _Optional:_ Customize MDX content via generator functions. See below for a list of supported options. |
178178
| `showSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates standalone schema pages and adds them to the sidebar. |
179+
| `showInfoPage` | `boolean` | `true` | _Optional:_ If set to `false`, disables generation of the info page (overview page with API title and description). |
180+
| `schemasOnly` | `boolean` | `false` | _Optional:_ If set to `true`, generates only schema pages (no API endpoint pages). Also available as `--schemas-only` CLI flag. |
179181

180182
### sidebarOptions
181183

packages/docusaurus-plugin-openapi-docs/src/openapi/openapi.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ function createItems(
9797
const infoId = kebabCase(infoIdSpaces);
9898
const schemasOnly = options?.schemasOnly === true;
9999

100-
if (openapiData.info.description || openapiData.info.title) {
101-
// Only create an info page if we have a description.
100+
// Only create an info page if we have a description/title AND showInfoPage is not false
101+
if (
102+
(openapiData.info.description || openapiData.info.title) &&
103+
options?.showInfoPage !== false
104+
) {
102105
const infoDescription = openapiData.info?.description;
103106
let splitDescription: any;
104107
if (infoDescription) {

packages/docusaurus-plugin-openapi-docs/src/options.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export const OptionsSchema = Joi.object({
4848
sidebarOptions: sidebarOptions,
4949
markdownGenerators: markdownGenerators,
5050
showSchemas: Joi.boolean(),
51+
showInfoPage: Joi.boolean(),
52+
schemasOnly: Joi.boolean(),
5153
disableCompression: Joi.boolean(),
5254
maskCredentials: Joi.boolean(),
5355
version: Joi.string().when("versions", {

packages/docusaurus-plugin-openapi-docs/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export interface APIOptions {
5151
proxy?: string;
5252
markdownGenerators?: MarkdownGenerator;
5353
showSchemas?: boolean;
54+
showInfoPage?: boolean;
5455
schemasOnly?: boolean;
5556
disableCompression?: boolean;
5657
maskCredentials?: boolean;

0 commit comments

Comments
 (0)