Skip to content

Commit c54ba49

Browse files
committed
add x-hidden docs
1 parent d5314be commit c54ba49

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

api-playground/openapi/advanced-features.mdx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,43 @@ paths:
135135
const planter = require('planter');
136136
planter.list({ potted: true });
137137
```
138+
139+
## `x-hidden`
140+
141+
If your pages are [autogenerated](/openapi/setup) from an OpenAPI document, but there are some paths that you don't want to create pages for, you can hide them by adding the property `x-hidden`.
142+
143+
You can add the `x-hidden` tag under endpoint or webhook paths below the method.
144+
145+
Here's are examples of how that would look in an OpenAPI schema document for an endpoint or a webhook path:
146+
147+
```json {14}
148+
"paths": {
149+
"/plants": {
150+
"get": {
151+
"description": "Returns all plants from the store",
152+
"parameters": { ... },
153+
"responses": { ... },
154+
}
155+
}
156+
"/secret_plants": {
157+
"get": {
158+
"description": "Returns all secret plants from the store (do not publish this endpoint!)",
159+
"parameters": { ... },
160+
"responses": { ... },
161+
"x-hidden": true
162+
}
163+
}
164+
},
165+
```
166+
167+
```json {5}
168+
"webhooks": {
169+
"/secret_pants_hook": {
170+
"post": {
171+
"description": "Secret webhook for information about a new plant added to the store",
172+
"x-hidden": true
173+
}
174+
}
175+
}
176+
```
177+

api-playground/openapi/setup.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ When using this option, the metadata for the generated pages will have the follo
6161

6262
There are some scenarios in which the default behavior isn't sufficient. If you need more customizability, you can create an MDX page for your OpenAPI operation, and modify it just like any other MDX page.
6363

64+
<Tip>If you have some endpoints in your OpenAPI schema that you don't want pages generated for automatically, you can add the [x-hidden](/optnapi/advanced-features#x-hidden) property</Tip>
65+
6466
## Create MDX files for API pages
6567

6668
If you want to customize the page metadata, add additional content, omit certain OpenAPI operations, or reorder OpenAPI pages in your navigation, you'll need an MDX page for each operation. Here is [an example MDX OpenAPI page](https://github.com/mindsdb/mindsdb/blob/main/docs/rest/databases/create-databases.mdx) from [MindsDB](https://docs.mindsdb.com/rest/databases/create-databases).&#x20;

0 commit comments

Comments
 (0)