Skip to content

Commit b0951a7

Browse files
authored
docs: add troubleshooting for api pages (mintlify#267)
* add troubleshooting for api pages * make description more generic * add example for filenames and fix info * DNS provider -> reverse proxy
1 parent 431396c commit b0951a7

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

api-playground/troubleshooting.mdx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: 'Troubleshooting'
3+
description: 'Common issues with API References'
4+
icon: 'triangle-exclamation'
5+
---
6+
7+
API pages are complicated. As a result, there are a lot of things that can go wrong.
8+
Here's a list of common issues we've seen customers run into:
9+
10+
<AccordionGroup>
11+
<Accordion title="All of my OpenAPI pages are completely blank">
12+
In this scenario, it's likely that either Mintlify cannot find your OpenAPI document,
13+
or your OpenAPI document is invalid.
14+
15+
Running `mintlify dev` locally should reveal some of these issues.
16+
17+
To verify your OpenAPI document will pass validation:
18+
19+
1. Visit [this validator](https://apitools.dev/swagger-parser/online/)
20+
2. Switch to the "Validate text" tab
21+
3. Paste in your OpenAPI document
22+
4. Click "Validate it!"
23+
24+
If the text box that appears below has a green border, your document has passed validation.
25+
This is the exact validation package Mintlify uses to validate OpenAPI documents, so if your document
26+
passes validation here, there's a great chance the problem is elsewhere.
27+
</Accordion>
28+
29+
<Accordion title="One of my OpenAPI pages is completely blank">
30+
This is usually caused by a misspelled `openapi` field in the page metadata. Make sure
31+
the HTTP method and path match the HTTP method and path in the OpenAPI document exactly.
32+
33+
Here's an example of how things might go wrong:
34+
```md get-user.mdx
35+
---
36+
openapi: "GET /users/{id}/"
37+
---
38+
```
39+
40+
```yaml openapi.yaml
41+
paths:
42+
"/users/{id}":
43+
get:
44+
...
45+
```
46+
47+
Notice that the path in the `openapi` field has a trailing slash, whereas the path in the OpenAPI
48+
document does not.
49+
50+
Another common issue is a misspelled filename. If you are specifying a particular OpenAPI document
51+
in the `openapi` field, ensure the filename is correct. For example, if you have two OpenAPI
52+
documents `openapi/v1.json` and `openapi/v2.json`, your metadata might look like this:
53+
54+
```md api-reference/v1/users/get-user.mdx
55+
---
56+
openapi: "v1 GET /users/{id}"
57+
---
58+
```
59+
</Accordion>
60+
61+
<Accordion title="Requests from the API Playground don't work">
62+
If you have a custom domain configured, this could be an issue with your reverse proxy. By
63+
default, requests made via the API Playground start with a `POST` request to the
64+
`/api/request` path on the docs site. If your reverse proxy is configured to only allow `GET`
65+
requests, then all of these requests will fail. To fix this, configure your reverse proxy to
66+
allow `POST` requests to the `/api/request` path.
67+
68+
Alternatively, if your reverse proxy prevents you from accepting `POST` requests, you can configure
69+
Mintlify to send requests directly to your backend with the `api.playground.disableProxy`
70+
setting in the `mint.json`, as described [here](/settings/global#api-configurations). This will
71+
likely require you to configure CORS on your server, as these requests will now come directly
72+
from your users' browsers.
73+
</Accordion>
74+
</AccordionGroup>

mint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
"api-playground/mdx/configuration",
9696
"api-playground/mdx/authentication"
9797
]
98-
}
98+
},
99+
"api-playground/troubleshooting"
99100
]
100101
},
101102
{

0 commit comments

Comments
 (0)