diff --git a/api-playground/migrating-from-mdx.mdx b/api-playground/migrating-from-mdx.mdx index ddab2c6f..f623fda7 100644 --- a/api-playground/migrating-from-mdx.mdx +++ b/api-playground/migrating-from-mdx.mdx @@ -9,7 +9,47 @@ If you are currently using individual `MDX` pages for your API endpoints, you ca You can define metadata and content for each endpoint in your OpenAPI specification and organize endpoints where you want them in your navigation. -## Migration steps +## 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 reference OpenAPI endpoints. +- Extracts content from MDX files and moves it to the `x-mint` extension in your OpenAPI specification. +- Migrates any existing `x-mcp` data into `x-mint`. +- Updates your `docs.json` to reference the OpenAPI endpoints directly instead of MDX files. +- Deletes the original MDX endpoint files. + + +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. + +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`. + +The migration tool does not support previewing changes before applying them. + + + + + 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. + + + Validate your OpenAPI file using the [Swagger Editor](https://editor.swagger.io/) or [Mint CLI](https://www.npmjs.com/package/mint). + + + + If needed, install or update the [Mint CLI](/installation). + + + ```bash + mint migrate-mdx + ``` + + + +## Manual migration steps diff --git a/installation.mdx b/installation.mdx index 62b591a7..cf6089d8 100644 --- a/installation.mdx +++ b/installation.mdx @@ -126,6 +126,16 @@ You can rename and update all references to files using the following command: mint rename ``` +### Migrating MDX endpoint pages + +You can migrate MDX endpoint pages to autogenerated pages from your OpenAPI specification using 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](/api-playground/migrating-from-mdx) for detailed information. + ## Formatting While developing locally, we recommend using extensions in your IDE to recognize and format `MDX` files.