Skip to content

Commit a5856d7

Browse files
Edit OpenAPI docs (mintlify#242)
* Edit OpenAPI docs * permalink Co-authored-by: Mayank Shouche <[email protected]> * link to npm Co-authored-by: Mayank Shouche <[email protected]> --------- Co-authored-by: Mayank Shouche <[email protected]>
1 parent 3c6e539 commit a5856d7

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

api-playground/openapi/setup.mdx

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,13 @@ description: "Reference OpenAPI endpoints in your docs pages"
77

88
To describe your endpoints with OpenAPI, make sure you have a valid OpenAPI document in either JSON or YAML format that follows the [OpenAPI specification](https://swagger.io/specification/). Your document must follow OpenAPI specification 3.0+.
99

10-
There are two ways to configure your docs to use your OpenAPI file:
11-
12-
<AccordionGroup>
13-
<Accordion title="In the repo" icon="github">
14-
The most common method of setting up OpenAPI with Mintlify is to add your OpenAPI documents directly to your docs repo. The format will either be in `.yaml` or `.json`.
15-
</Accordion>
16-
<Accordion title="On the web" icon="globe">
17-
If you have a publicly-hosted OpenAPI document that serves as the single-source-of-truth for your API, you can use that in your docs through the document URL (ex: https://mintlify.com/specs/v2/openapi.json)
18-
</Accordion>
19-
</AccordionGroup>
20-
2110
## Autogenerating the API playground
2211

2312
You can either [autogenerate the API playground](/settings/navigation#tabs) or create MDX files for the individual OpenAPI endpoints.
2413

2514
### Auto-populate API pages
2615

27-
You can add an `openapi` field to an object in the `tabs` or `anchors` array in the `mint.json`. This can either be with OpenAPI documents that are in the docs repo or hosted at a link.
16+
You can add an `openapi` field to an object in the `tabs` or `anchors` array in the `mint.json`. This can either be with OpenAPI documents that are in the docs repo (json or yaml) or hosted at a link.
2817

2918
**Example with Anchors:**
3019

@@ -61,30 +50,30 @@ You can add an `openapi` field to an object in the `tabs` or `anchors` array in
6150

6251
### Create MDX files for OpenAPI endpoints
6352

64-
You can also create MDX files associated with each OpenAPI endpoint if you would like to add additional context to specific pages. Check out an example from [Elevenlabs](https://elevenlabs.io/docs/api-reference/speech-to-speech) below.
53+
You can also create MDX files associated with each OpenAPI endpoint if you would like to add additional context to specific pages or have more granular control over the navigation. Here is [the code](https://github.com/elevenlabs/elevenlabs-docs/blob/e5e267c97b8d1e4c21db1dcdb8b005eb1dfed7da/api-reference/speech-to-speech.mdx?plain=1#L2) from [Elevenlabs](https://elevenlabs.io/docs/api-reference/speech-to-speech).
6554

6655
![](/images/elevenlabs-mdx-autogeneration-example.png)
6756

68-
You can autogenerate these MDX files from your OpenAPI document using our scraper, or create each page manually.
57+
If you want to autogenerate MDX files for every endpoint in your OpenAPI document you can use our scraper.
6958

70-
#### Autogenerate files (Recommended)
59+
#### Autogenerate files
7160

72-
Our Mintlify [scraper](/api-playground/openapi/setup#autogenerate-files-recommended) helps autogenerate MDX files for your OpenAPI endpoints. Use the relative path to the OpenAPI document in your codebase. If you're using a publicly-hosted OpenAPI document, you can just supply the URL in place of a path.
61+
Our Mintlify [scraper](https://www.npmjs.com/package/@mintlify/scraping) autogenerates MDX files for your OpenAPI endpoints. Use the relative path to the OpenAPI document in your codebase. If you're using a publicly-hosted OpenAPI document, you can supply the URL in place of a path.
7362

7463
```bash
7564
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file>
7665
```
7766

7867

79-
Add the `-o` flag to specify a folder to populate the files into. If a folder is not specified, the files will populate into the current folder.
68+
Add the `-o` flag to specify a folder to populate the files into. If a folder is not specified, the files will populate in the working directory.
8069

8170
```bash
8271
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file> -o api-reference
8372
```
8473

8574
Learn more about our scraping package [here](https://www.npmjs.com/package/@mintlify/scraping).
8675

87-
The scraper will output an array of [Navigation entries](/settings/global#structure) containing your OpenAPI MDX files. You can either append these entries to your existing Navigation, or add the files to your Navigation manually.
76+
The scraper will output an array of [Navigation entries](/settings/global#structure) containing your OpenAPI MDX files. You can either append these entries to your existing Navigation, or reorder and add the files to your navigation manually.
8877

8978
<Note>
9079
If your OpenAPI document is invalid, the files will not autogenerate.
@@ -96,7 +85,7 @@ The scraper will output an array of [Navigation entries](/settings/global#struct
9685

9786
By using the OpenAPI reference, the name, description, parameters, responses, and the API playground will be automatically generated using the specifications.
9887

99-
If you have multiple OpenAPI files, include the name of the OpenAPI file (without the file type `.json` or `.yaml`) to correctly map the information.
88+
If you have multiple OpenAPI files, include the name of the OpenAPI file (without the file type `.json` or `.yaml`) to correctly map the information. This is not required if you have only one OpenAPI file - it will automatically detect your OpenAPI file.
10089

10190
<CodeGroup>
10291

@@ -119,12 +108,12 @@ openapi: openapi-file-name method endpoint
119108
<Note>
120109
The method endpoint must match the endpoint specified in the OpenAPI
121110
specifications exactly. If the endpoint doesn't exist in the OpenAPI file,
122-
an empty page will be rendered.
111+
the page will be empty.
123112
</Note>
124113

125114
## Create MDX files for OpenAPI schemas
126115

127-
Mintlify also allows you to create individual pages for any OpenAPI schemas defined in an OpenAPI document's `components.schemas` field:
116+
Mintlify also allows you to create individual pages for any OpenAPI schema defined in an OpenAPI document's `components.schemas` field:
128117

129118
<CodeGroup>
130119

0 commit comments

Comments
 (0)