Skip to content

Commit 7b84148

Browse files
authored
x-mint migrate script (#1023)
* add command to CLI page * add steps for CLI migration * reviewer feedback
1 parent 658b0e7 commit 7b84148

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

api-playground/migrating-from-mdx.mdx

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,46 @@ If you are currently using individual `MDX` pages for your API endpoints, you ca
99

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

12-
## Migration steps
12+
## CLI migration
13+
14+
The `mint migrate-mdx` command is the recommended way to migrate from MDX endpoint pages to autogenerated pages.
15+
16+
This command:
17+
- Parses your `docs.json` navigation structure.
18+
- Identifies MDX pages that generate OpenAPI endpoint pages.
19+
- Extracts content from MDX files and moves it to the `x-mint` extension in your OpenAPI specification.
20+
- Updates your `docs.json` to reference the OpenAPI endpoints directly instead of MDX files.
21+
- Deletes the original MDX endpoint files.
22+
23+
<Info>
24+
If you already have `x-mint` defined for an endpoint and also have an MDX page with content for that endpoint, the MDX content will overwrite existing `x-mint` settings.
25+
26+
If you have multiple MDX pages for the same endpoint with different content, the script will use the content from the page that appears last in your `docs.json`.
27+
28+
The migration tool does not support previewing changes before applying them.
29+
</Info>
30+
31+
<Steps>
32+
<Step title="Prepare your OpenAPI specification.">
33+
Ensure your OpenAPI specification is valid and includes all endpoints you want to document.
34+
35+
Any MDX pages you want to migrate must have the `openapi:` frontmatter referencing an endpoint.
36+
37+
<Tip>
38+
Validate your OpenAPI file using the [Swagger Editor](https://editor.swagger.io/) or [Mint CLI](https://www.npmjs.com/package/mint).
39+
</Tip>
40+
</Step>
41+
<Step title="Install the Mint CLI">
42+
If needed, install or update the [Mint CLI](/installation).
43+
</Step>
44+
<Step title="Run the migration command.">
45+
```bash
46+
mint migrate-mdx
47+
```
48+
</Step>
49+
</Steps>
50+
51+
## Manual migration steps
1352

1453
<Steps>
1554
<Step title="Prepare your OpenAPI specification.">

installation.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ You can rename and update all references to files using the following command:
126126
mint rename <oldFilename> <newFilename>
127127
```
128128

129+
### Migrating MDX endpoint pages
130+
131+
You can migrate MDX endpoint pages to autogenerated pages from your OpenAPI specification using the following command:
132+
133+
```bash
134+
mint migrate-mdx
135+
```
136+
137+
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](/api-playground/migrating-from-mdx) for detailed information.
138+
129139
## Formatting
130140

131141
While developing locally, we recommend using extensions in your IDE to recognize and format `MDX` files.

0 commit comments

Comments
 (0)