Skip to content

Commit 0726d80

Browse files
authored
feat: add CLI option for schema-only generation (#1228)
* feat: add CLI option for schema-only generation * feat: add --schemas-only flag to clean-api-docs commands - Add --schemas-only option to clean-api-docs command - Add --schemas-only option to clean-api-docs:version command - When --schemas-only is used, only the schemas/ directory is cleaned - API, info, tag docs and sidebar files are left untouched - Update documentation in all README files * docs: add missing version flag notes to intro.mdx
1 parent bac31b9 commit 0726d80

File tree

7 files changed

+209
-58
lines changed

7 files changed

+209
-58
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,16 @@ yarn docusaurus gen-api-docs all --all-versions
307307

308308
> This will generate API docs for all versions of all the OpenAPI specification (OAS) files referenced in your `docusaurus-plugin-openapi-docs` config.
309309
310+
To generate only schema MDX files—without updating the sidebar or requiring `showSchemas` in your plugin config—use the `--schemas-only` flag:
311+
312+
```bash
313+
yarn docusaurus gen-api-docs petstore --schemas-only
314+
```
315+
316+
> This command writes the schema pages to the configured output directory while leaving other generated docs untouched.
317+
318+
The `--schemas-only` flag is also available for `gen-api-docs:version`.
319+
310320
### Cleaning API Docs
311321

312322
To clean/remove all API Docs, run the following command from the root directory of your project:
@@ -339,6 +349,14 @@ yarn docusaurus clean-api-docs all --all-versions
339349

340350
> This will clean API docs for all versions of all the OpenAPI specification (OAS) files referenced in your `docusaurus-plugin-openapi-docs` config.
341351
352+
To clean only schema docs while leaving API, info, and tag docs untouched, use the `--schemas-only` flag:
353+
354+
```bash
355+
yarn docusaurus clean-api-docs petstore --schemas-only
356+
```
357+
358+
> The `--schemas-only` flag is also available for `clean-api-docs:version`.
359+
342360
### Versioning OpenAPI docs
343361

344362
To generate _all_ versioned OpenAPI docs, run the following command from the root directory of your project:

demo/docs/intro.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,16 @@ Example:
363363
yarn docusaurus gen-api-docs petstore
364364
```
365365

366+
To generate only schema MDX files—without updating the sidebar or requiring `showSchemas` in your plugin config—use the `--schemas-only` flag:
367+
368+
```bash title="generating only schema docs for 'petstore'"
369+
yarn docusaurus gen-api-docs petstore --schemas-only
370+
```
371+
372+
> This command writes the schema pages to the configured output directory while leaving other generated docs untouched.
373+
374+
The `--schemas-only` flag is also available for `gen-api-docs:version`.
375+
366376
### Cleaning API Docs
367377

368378
To clean/remove all API Docs, run the following command from the root directory of your project:
@@ -383,6 +393,14 @@ Example:
383393
yarn docusaurus clean-api-docs petstore
384394
```
385395

396+
To clean only schema docs while leaving API, info, and tag docs untouched, use the `--schemas-only` flag:
397+
398+
```bash title="cleaning only schema docs for 'petstore'"
399+
yarn docusaurus clean-api-docs petstore --schemas-only
400+
```
401+
402+
> The `--schemas-only` flag is also available for `clean-api-docs:version`.
403+
386404
### Versioning OpenAPI docs
387405

388406
To generate _all_ versioned OpenAPI docs, run the following command from the root directory of your project:

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,16 @@ yarn docusaurus gen-api-docs all --all-versions
328328

329329
> This will generate API docs for all versions of all the OpenAPI specification (OAS) files referenced in your `docusaurus-plugin-openapi-docs` config.
330330
331+
To generate only schema MDX files—without updating the sidebar or requiring `showSchemas` in your plugin config—use the `--schemas-only` flag:
332+
333+
```bash
334+
yarn docusaurus gen-api-docs petstore --schemas-only
335+
```
336+
337+
> This command writes the schema pages to the configured output directory while leaving other generated docs untouched.
338+
339+
The `--schemas-only` flag is also available for `gen-api-docs:version`.
340+
331341
### Cleaning API Docs
332342

333343
To clean/remove all API Docs, run the following command from the root directory of your project:
@@ -360,6 +370,14 @@ yarn docusaurus clean-api-docs all --all-versions
360370

361371
> This will clean API docs for all versions of all the OpenAPI specification (OAS) files referenced in your `docusaurus-plugin-openapi-docs` config.
362372
373+
To clean only schema docs while leaving API, info, and tag docs untouched, use the `--schemas-only` flag:
374+
375+
```bash
376+
yarn docusaurus clean-api-docs petstore --schemas-only
377+
```
378+
379+
> The `--schemas-only` flag is also available for `clean-api-docs:version`.
380+
363381
### Versioning OpenAPI docs
364382

365383
To generate _all_ versioned OpenAPI docs, run the following command from the root directory of your project:

0 commit comments

Comments
 (0)