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/mdx-setup.mdx
+69-1Lines changed: 69 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,75 @@ You can manually define API endpoints in individual MDX pages. This approach is
95
95
```
96
96
</Step>
97
97
<Steptitle="Add your endpoints to your docs">
98
-
Add your endpoint pages to the navigation by updating the `pages` field in your `docs.json`. Learn more about structuring your docs in [Navigation](/organize/navigation).
98
+
Add your endpoint pages to the navigation by updating the `pages` field in your `docs.json`:
99
+
100
+
```json docs.json
101
+
"navigation": {
102
+
"tabs": [
103
+
{
104
+
"tab": "API Reference",
105
+
"groups": [
106
+
{
107
+
"group": "Users",
108
+
"pages": [
109
+
"api-reference/users/create-user",
110
+
"api-reference/users/get-user",
111
+
"api-reference/users/update-user"
112
+
]
113
+
},
114
+
{
115
+
"group": "Orders",
116
+
"pages": [
117
+
"api-reference/orders/create-order",
118
+
"api-reference/orders/list-orders"
119
+
]
120
+
}
121
+
]
122
+
}
123
+
]
124
+
}
125
+
```
126
+
127
+
Each page path corresponds to an MDX file in your docs repository. For example, `api-reference/users/create-user.mdx`. Learn more about structuring your docs in [Navigation](/organize/navigation).
128
+
129
+
### Using OpenAPI endpoints in navigation
130
+
131
+
If you have an OpenAPI specification, you can reference endpoints directly in your navigation without creating individual MDX files. Reference specific endpoints by including the OpenAPI file path and the endpoint:
132
+
133
+
```json docs.json
134
+
"navigation": {
135
+
"pages": [
136
+
"introduction",
137
+
"/path/to/users-openapi.json POST /users",
138
+
"/path/to/orders-openapi.json GET /orders"
139
+
]
140
+
}
141
+
```
142
+
143
+
You can also set a default OpenAPI spec for a navigation group and reference endpoints by method and path:
144
+
145
+
```json docs.json
146
+
{
147
+
"group": "API reference",
148
+
"openapi": "/path/to/openapi-v1.json",
149
+
"pages": [
150
+
"overview",
151
+
"authentication",
152
+
"GET /users",
153
+
"POST /users",
154
+
{
155
+
"group": "Orders",
156
+
"openapi": "/path/to/openapi-v2.json",
157
+
"pages": [
158
+
"GET /orders",
159
+
"POST /orders"
160
+
]
161
+
}
162
+
]
163
+
}
164
+
```
165
+
166
+
For more details on OpenAPI integration, see [OpenAPI setup](/api-playground/openapi-setup).
0 commit comments