Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions api-playground/openapi/advanced-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

## `oneOf`, `anyOf`, `allOf`

For complex datatypes, OpenAPI provides the `oneOf`, `anyOf`, and `allOf` keywords, allowing you to combine schemas in certain ways. You can read more about these keywords in the [Swagger documentation](https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/), but essentially:

Check warning on line 10 in api-playground/openapi/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

api-playground/openapi/advanced-features.mdx#L10

Did you really mean 'datatypes'?

- `oneOf` functions like an "exclusive-or" operator
- `anyOf` functions like an "or" operator
Expand Down Expand Up @@ -54,7 +54,7 @@

### Providing options with `oneOf` and `anyOf`

When you use `oneOf` or `anyOf`, Mintlify displays the options in a tabbed container. To give your options helpful names, make sure to give each subschema a `title` field. For example, here's how you might display two different types of delivery addresses:

Check warning on line 57 in api-playground/openapi/advanced-features.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

api-playground/openapi/advanced-features.mdx#L57

Did you really mean 'subschema'?

```yaml
delivery_address:
Expand Down Expand Up @@ -135,3 +135,43 @@
const planter = require('planter');
planter.list({ potted: true });
```

## `x-hidden`

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`.

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
}
}
}
```

2 changes: 2 additions & 0 deletions api-playground/openapi/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@

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.

<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>

## 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).&#x20;
Expand Down Expand Up @@ -106,12 +108,12 @@
and the correct method will be generated.
</Note>

### Autogenerate files

Check warning on line 111 in api-playground/openapi/setup.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

api-playground/openapi/setup.mdx#L111

Did you really mean 'Autogenerate'?

For large OpenAPI documents, creating one MDX page for each OpenAPI operation can be a lot of work. To make it easier, we created a local OpenAPI page scraper.

Our Mintlify [scraper](https://www.npmjs.com/package/@mintlify/scraping)
autogenerates MDX files for your OpenAPI endpoints.

Check warning on line 116 in api-playground/openapi/setup.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

api-playground/openapi/setup.mdx#L116

Did you really mean 'autogenerates'?

Each generated page will correspond to an OpenAPI operation under the "paths" section of the OpenAPI schema.
If your OpenAPI document is version 3.1+, the scraper will also generate pages for webhooks under the "webhooks" section of the OpenAPI schema.
Expand All @@ -136,7 +138,7 @@
reorder and add the files to your navigation manually.

<Note>
If your OpenAPI document is invalid, the files will not autogenerate.

Check warning on line 141 in api-playground/openapi/setup.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

api-playground/openapi/setup.mdx#L141

Did you really mean 'autogenerate'?
</Note>


Expand Down
Loading