Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 0 additions & 12 deletions api-playground/openapi-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,6 @@ version: "version-string" (not required)

The method and path must exactly match your OpenAPI spec. If you have multiple OpenAPI specifications, include the path to the correct specification in your reference. You can also reference external OpenAPI URLs in `docs.json`.

#### Autogenerate endpoint pages

To autogenerate MDX files from your OpenAPI specification, use the Mintlify [scraper](https://www.npmjs.com/package/@mintlify/scraping).

```bash
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file> -o <folder-name>
```

<Tip>
Add the `-o` flag to specify a folder to populate the files into. If a folder is not specified, the files populate in the working directory.
</Tip>

### Document data models

Create a page for each data structure defined in your OpenAPI specification's `components.schemas` using the `openapi-schema` field in the frontmatter.
Expand Down
43 changes: 2 additions & 41 deletions guides/migrating-from-mdx.mdx
Original file line number Diff line number Diff line change
@@ -1,54 +1,15 @@
---
title: "Migrating MDX API pages to OpenAPI navigation"
sidebarTitle: "Migrate from MDX to OAS"

Check warning on line 3 in guides/migrating-from-mdx.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

guides/migrating-from-mdx.mdx#L3

Spell out 'OAS', if it's unfamiliar to the audience.
description: "Migrate your manually written MDX API pages to automated OpenAPI-generated documentation with flexible navigation and endpoint grouping."
keywords: ["API migration", "mint migrate-mdx", "OpenAPI migration", "x-mint extension"]
keywords: ["API migration", "OpenAPI migration", "x-mint extension"]
---

If you are currently using individual MDX pages for your API endpoints, you can migrate to autogenerating pages from your OpenAPI specification while retaining the customizability of individual pages. This can help you reduce the number of files you need to maintain and improve the consistency of your API documentation.

You can define metadata and content for each endpoint in your OpenAPI specification and organize endpoints where you want them in your navigation.

## CLI migration

The `mint migrate-mdx` command is the recommended way to migrate from MDX endpoint pages to autogenerated pages.

This command:
- Parses your `docs.json` navigation structure.
- Identifies MDX pages that generate OpenAPI endpoint pages.
- Extracts content from MDX files and moves it to the `x-mint` extension in your OpenAPI specification.
- Updates your `docs.json` to reference the OpenAPI endpoints directly instead of MDX files.
- Deletes the original MDX endpoint files.

<Info>
If you already have `x-mint` defined for an endpoint and also have an MDX page with content for that endpoint, the MDX content overwrites existing `x-mint` settings.

If you have multiple MDX pages for the same endpoint with different content, the script uses the content from the page that appears last in your `docs.json`.

The migration tool does not support previewing changes before applying them.
</Info>

<Steps>
<Step title="Prepare your OpenAPI specification.">
Ensure your OpenAPI specification is valid and includes all endpoints you want to document.

Any MDX pages you want to migrate must have the `openapi:` frontmatter referencing an endpoint.

<Tip>
Validate your OpenAPI file using the [Swagger Editor](https://editor.swagger.io/) or [Mint CLI](https://www.npmjs.com/package/mint).
</Tip>
</Step>
<Step title="Install the Mint CLI">
If needed, install or update the [Mint CLI](/installation).
</Step>
<Step title="Run the migration command.">
```bash
mint migrate-mdx
```
</Step>
</Steps>

## Manual migration steps
## Migration steps

<Steps>
<Step title="Prepare your OpenAPI specification.">
Expand Down
60 changes: 1 addition & 59 deletions installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ keywords: ["CLI", "npm", "local development", "Node.js", "pnpm", "mint dev", "br

Use the [CLI](https://www.npmjs.com/package/mint) to preview your documentation locally as you write and edit. View changes in real-time before deploying, test your documentation site's appearance and features, and catch issues like broken links or accessibility problems.

The CLI also has utilities for maintaining your documentation, including commands to rename files, validate OpenAPI specifications, and migrate content between formats.
The CLI also has utilities for maintaining your documentation, including commands to validate OpenAPI specifications and check for broken links or accessibility issues.

## Prerequisites

Expand Down Expand Up @@ -258,30 +258,6 @@ mint workflow

The CLI prompts you for a name, trigger type, and other settings, then creates a `.md` file in `.mintlify/workflows/`.

### Rename files

Rename and update all references to files with the following command:

```bash
mint rename <path/to/old-filename> <path/to/new-filename>
```

Use `--force` to rename files and skip errors:

```bash
mint rename <path/to/old-filename> <path/to/new-filename> --force
```

### Migrate MDX endpoint pages

Migrate MDX endpoint pages to autogenerated pages from your OpenAPI specification with the following command:

```bash
mint migrate-mdx
```

This command converts individual MDX endpoint pages to autogenerated pages defined in your `docs.json`, moves MDX content to the `x-mint` extension in your OpenAPI specification, and updates your navigation. See [Migrating from MDX](/guides/migrating-from-mdx) for detailed information.

### Export for offline viewing

Export your entire documentation site as a self-contained zip archive for offline viewing and distribution:
Expand All @@ -298,40 +274,6 @@ mint export --output customer-docs.zip --groups enterprise

See [Offline export](/deploy/export) for details on all options and distributing the exported archive.

### Import content

Scrape content from an external documentation site or OpenAPI specification using the `mint scrape` commands. This is useful when you migrate your documentation from another platform to Mintlify.

**Import an entire site:**

```bash
mint scrape <url>
```

Use the `--filter` (or `-f`) flag to limit scraping to URLs matching a specific path prefix:

```bash
mint scrape <url> --filter=<path>
```

**Import a single page:**

```bash
mint scrape page <url>
```

**Generate pages from an OpenAPI spec:**

```bash
mint scrape openapi <openApiFilename or URL>
```

| Flag | Description |
| --- | --- |
| `--outDir` | Directory to write generated files. Defaults to `./docs`. |
| `--overwrite` | Overwrite existing files. |
| `--no-writeFiles` | Preview output without writing files. |

### Upgrade configuration

Convert a `mint.json` configuration file to the current `docs.json` format:
Expand Down
12 changes: 1 addition & 11 deletions migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,7 @@ To migrate your content to Mintlify, you need:

1. If your content is already in Markdown format, copy the content to your Mintlify project. Otherwise, convert your content to MDX format.
2. Create your `docs.json` referencing the paths to your Markdown pages.
3. If you have OpenAPI specifications, add them to your `docs.json` and configure the API playground. You can also generate MDX pages from your spec using the `mint scrape openapi` command:

```bash
mint scrape openapi <openApiFilename or URL>
```

| Flag | Description |
| --- | --- |
| `--outDir` | Directory to write generated files. Defaults to `./docs`. |
| `--overwrite` | Overwrite existing files. |
| `--no-writeFiles` | Preview output without writing files. |
3. If you have OpenAPI specifications, add them to your `docs.json` and configure the API playground. See [OpenAPI setup](/api-playground/openapi-setup) for more information.

<Tip>
If you migrate your content as `.md` files, convert them to `.mdx` to support interactive features like React components.
Expand Down
Loading