diff --git a/api-playground/openapi/advanced-features.mdx b/api-playground/openapi/advanced-features.mdx index d68b47e6e..cf92428e1 100644 --- a/api-playground/openapi/advanced-features.mdx +++ b/api-playground/openapi/advanced-features.mdx @@ -135,3 +135,43 @@ paths: const planter = require('planter'); planter.list({ potted: true }); ``` + +## `x-hidden` + +If your pages are [autogenerated](/api-playground/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`. + +You can add the `x-hidden` tag under endpoint or webhook paths below the method. + +Here's are examples of how that would look in an OpenAPI schema document for an endpoint or a webhook path: + +```json {14} +"paths": { + "/plants": { + "get": { + "description": "Returns all plants from the store", + "parameters": { ... }, + "responses": { ... }, + } + } + "/secret_plants": { + "get": { + "description": "Returns all secret plants from the store (do not publish this endpoint!)", + "parameters": { ... }, + "responses": { ... }, + "x-hidden": true + } + } +}, +``` + +```json {5} +"webhooks": { + "/secret_pants_hook": { + "post": { + "description": "Secret webhook for information about a new plant added to the store", + "x-hidden": true + } + } +} +``` + diff --git a/api-playground/openapi/setup.mdx b/api-playground/openapi/setup.mdx index ff34e940c..5615bed6f 100644 --- a/api-playground/openapi/setup.mdx +++ b/api-playground/openapi/setup.mdx @@ -61,6 +61,8 @@ When using this option, the metadata for the generated pages will have the follo 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. +If you have some endpoints in your OpenAPI schema that you don't want pages generated for automatically, you can add the [x-hidden](/api-playground/openapi/advanced-features#x-hidden) property + ## Create MDX files for API pages 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).