You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api-playground/openapi/setup.mdx
+10-21Lines changed: 10 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,24 +7,13 @@ description: "Reference OpenAPI endpoints in your docs pages"
7
7
8
8
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+.
9
9
10
-
There are two ways to configure your docs to use your OpenAPI file:
11
-
12
-
<AccordionGroup>
13
-
<Accordiontitle="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
-
<Accordiontitle="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
-
21
10
## Autogenerating the API playground
22
11
23
12
You can either [autogenerate the API playground](/settings/navigation#tabs) or create MDX files for the individual OpenAPI endpoints.
24
13
25
14
### Auto-populate API pages
26
15
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.
28
17
29
18
**Example with Anchors:**
30
19
@@ -61,30 +50,30 @@ You can add an `openapi` field to an object in the `tabs` or `anchors` array in
61
50
62
51
### Create MDX files for OpenAPI endpoints
63
52
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).
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.
69
58
70
-
#### Autogenerate files (Recommended)
59
+
#### Autogenerate files
71
60
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.
Learn more about our scraping package [here](https://www.npmjs.com/package/@mintlify/scraping).
86
75
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.
88
77
89
78
<Note>
90
79
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
96
85
97
86
By using the OpenAPI reference, the name, description, parameters, responses, and the API playground will be automatically generated using the specifications.
98
87
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.
0 commit comments