OpenAPI Generator
Generating docs for OpenAPI schema
Usage
Install the required packages.
Generate Styles
The interactive UI of OpenAPI integration is styled with Tailwind CSS, it doesn't include a pre-built stylesheet by default. You must use it in conjunction with the official Tailwind CSS plugin.
Add the package to content
under your Tailwind CSS configuration.
Generate Files
Create a script:
Only OpenAPI 3.0 is supported.
It doesn't allow JSON schema specific keywords like const
, as they are unsupported
Generate docs with the script:
Fumadocs OpenAPI generates MDX content directly, you can use a formatter (e.g. Prettier) to format the output files.
Features
The official OpenAPI integration supports:
- Basic API endpoint information
- Interactive API playground
- Example code to send request (in different programming languages)
- Response samples and TypeScript definitions
- Request parameters and body generated from schemas
Demo
Options
You can also pass options to the generateFiles
function.
Input
An array of input files (path), wildcard allowed.
Output
Path to the output directory.
Per
Customise how the page is generated, default to file
.
mode | description |
---|---|
tag | Generate a page for each tag |
file | Generate a page for each schema |
Name
A function that controls the output path of files.
Imports
The imports on the top of MDX files. When not specified, it imports the required components from the package itself.
Frontmatter
Customise the frontmatter of MDX files.
By default, it includes a full: true
property for Fumadocs UI.
Generate Code Samples
Generate custom code samples for each API endpoint.
In addition, you can also specify code samples via OpenAPI schema.
Renderer
Customise how components are generated.
Last updated on