Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following
| `versions` | `object` | `null` | _Optional:_ Options for versioning configuration. See below for a list of supported options. |
| `markdownGenerators` | `object` | `null` | _Optional:_ Customize MDX content via generator functions. See below for a list of supported options. |
| `showSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates standalone schema pages and adds them to the sidebar. |
| `generateSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates schema pages for all schemas referenced in the OpenAPI spec (not added in sidebar). |

### sidebarOptions

Expand Down
1 change: 1 addition & 0 deletions demo/docs/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following
| `versions` | `object` | `null` | _Optional:_ Options for versioning configuration. See below for a list of supported options. |
| `markdownGenerators` | `object` | `null` | _Optional:_ Customize MDX content via generator functions. See below for a list of supported options. |
| `showSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates standalone schema pages and adds them to the sidebar. |
| `generateSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates schema pages for all schemas referenced in the OpenAPI spec (not added in sidebar). |

### sidebarOptions

Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus-plugin-openapi-docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following
| `versions` | `object` | `null` | _Optional:_ Options for versioning configuration. See below for a list of supported options. |
| `markdownGenerators` | `object` | `null` | _Optional:_ Customize MDX content via generator functions. See below for a list of supported options. |
| `showSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates standalone schema pages and adds them to the sidebar. |
| `generateSchemas` | `boolean` | `null` | _Optional:_ If set to `true`, generates schema pages for all schemas referenced in the OpenAPI spec (not added in sidebar). |

### sidebarOptions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ function createItems(

if (
options?.showSchemas === true ||
options?.generateSchemas === true ||
Object.entries(openapiData?.components?.schemas ?? {})
.flatMap(([_, s]) => s["x-tags"])
.filter((item) => !!item).length > 0
Expand All @@ -431,7 +432,11 @@ function createItems(
for (let [schema, schemaObject] of Object.entries(
openapiData?.components?.schemas ?? {}
)) {
if (options?.showSchemas === true || schemaObject["x-tags"]) {
if (
options?.showSchemas === true ||
options?.generateSchemas === true ||
schemaObject["x-tags"]
) {
const baseIdSpaces =
schemaObject?.title?.replace(" ", "-").toLowerCase() ?? "";
const baseId = kebabCase(baseIdSpaces);
Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus-plugin-openapi-docs/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const OptionsSchema = Joi.object({
sidebarOptions: sidebarOptions,
markdownGenerators: markdownGenerators,
showSchemas: Joi.boolean(),
generateSchemas: Joi.boolean(),
disableCompression: Joi.boolean(),
version: Joi.string().when("versions", {
is: Joi.exist(),
Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus-plugin-openapi-docs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface APIOptions {
proxy?: string;
markdownGenerators?: MarkdownGenerator;
showSchemas?: boolean;
generateSchemas?: boolean;
disableCompression?: boolean;
}

Expand Down
Loading