Skip to content

Commit 559ecc0

Browse files
committed
openapi linehighlighting
1 parent 7a00a0c commit 559ecc0

File tree

1 file changed

+38
-15
lines changed

1 file changed

+38
-15
lines changed

api-playground/openapi/setup.mdx

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@ description: "Reference OpenAPI endpoints in your docs pages"
55

66
## Add an OpenAPI specification file
77

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+.
8+
To describe your endpoints with OpenAPI, make sure you have a valid OpenAPI
9+
document in either JSON or YAML format that follows the
10+
[OpenAPI specification](https://swagger.io/specification/). Your document must
11+
follow OpenAPI specification 3.0+.
912

1013
## Autogenerating the API playground
1114

12-
You can either [autogenerate the API playground](/settings/navigation#tabs) or create MDX files for the individual OpenAPI endpoints.
15+
You can either [autogenerate the API playground](/settings/navigation#tabs) or
16+
create MDX files for the individual OpenAPI endpoints.
1317

1418
### Auto-populate API pages
1519

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.
20+
You can add an `openapi` field to an object in the `tabs` or `anchors` array in
21+
the `mint.json`. This can either be with OpenAPI documents that are in the docs
22+
repo (json or yaml) or hosted at a link.
1723

1824
**Example with Anchors:**
1925

20-
```json
26+
```json {5}
2127
{
2228
"anchors": [
2329
{
@@ -34,7 +40,7 @@ You can add an `openapi` field to an object in the `tabs` or `anchors` array in
3440

3541
**Example with Tabs:**
3642

37-
```json
43+
```json {6}
3844
{
3945
"tabs": [
4046
{
@@ -50,30 +56,42 @@ You can add an `openapi` field to an object in the `tabs` or `anchors` array in
5056

5157
### Create MDX files for OpenAPI endpoints
5258

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).
59+
You can also create MDX files associated with each OpenAPI endpoint if you would
60+
like to add additional context to specific pages or have more granular control
61+
over the navigation. Here is
62+
[the code](https://github.com/elevenlabs/elevenlabs-docs/blob/e5e267c97b8d1e4c21db1dcdb8b005eb1dfed7da/api-reference/speech-to-speech.mdx?plain=1#L2)
63+
from [Elevenlabs](https://elevenlabs.io/docs/api-reference/speech-to-speech).
5464

5565
![](/images/elevenlabs-mdx-autogeneration-example.png)
5666

57-
If you want to autogenerate MDX files for every endpoint in your OpenAPI document you can use our scraper.
67+
If you want to autogenerate MDX files for every endpoint in your OpenAPI
68+
document you can use our scraper.
5869

5970
#### Autogenerate files
6071

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.
72+
Our Mintlify [scraper](https://www.npmjs.com/package/@mintlify/scraping)
73+
autogenerates MDX files for your OpenAPI endpoints. Use the relative path to the
74+
OpenAPI document in your codebase. If you're using a publicly-hosted OpenAPI
75+
document, you can supply the URL in place of a path.
6276

6377
```bash
6478
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file>
6579
```
6680

67-
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.
81+
Add the `-o` flag to specify a folder to populate the files into. If a folder is
82+
not specified, the files will populate in the working directory.
6983

7084
```bash
7185
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file> -o api-reference
7286
```
7387

74-
Learn more about our scraping package [here](https://www.npmjs.com/package/@mintlify/scraping).
88+
Learn more about our scraping package
89+
[here](https://www.npmjs.com/package/@mintlify/scraping).
7590

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.
91+
The scraper will output an array of
92+
[Navigation entries](/settings/global#structure) containing your OpenAPI MDX
93+
files. You can either append these entries to your existing Navigation, or
94+
reorder and add the files to your navigation manually.
7795

7896
<Note>
7997
If your OpenAPI document is invalid, the files will not autogenerate.
@@ -83,9 +101,13 @@ The scraper will output an array of [Navigation entries](/settings/global#struct
83101

84102
<Snippet file="api-playground/openapi.mdx" />
85103

86-
By using the OpenAPI reference, the name, description, parameters, responses, and the API playground will be automatically generated using the specifications.
104+
By using the OpenAPI reference, the name, description, parameters, responses,
105+
and the API playground will be automatically generated using the specifications.
87106

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.
107+
If you have multiple OpenAPI files, include the name of the OpenAPI file
108+
(without the file type `.json` or `.yaml`) to correctly map the information.
109+
This is not required if you have only one OpenAPI file - it will automatically
110+
detect your OpenAPI file.
89111

90112
<CodeGroup>
91113

@@ -113,7 +135,8 @@ openapi: openapi-file-name method endpoint
113135

114136
## Create MDX files for OpenAPI schemas
115137

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

118141
<CodeGroup>
119142

0 commit comments

Comments
 (0)