Docusaurus OpenAPI
OpenAPI plugin for generating API reference docs in Docusaurus v2.
Multiple OpenAPI Definitions
To have more than one OpenAPI pages, add additional OpenAPI plugin instances:
{
presets: [
[
'docusaurus-preset-openapi',
{
api: {
path: 'cars/openapi.json',
routeBasePath: 'cars',
},
},
],
],
plugins: [
[
'docusaurus-plugin-openapi',
{
id: 'trains',
path: 'trains/openapi.json',
routeBasePath: 'trains',
},
],
[
'docusaurus-plugin-openapi',
{
id: 'bikes',
path: 'bikes/openapi.json',
routeBasePath: 'bikes',
},
],
],
}
This will create routes for /cars
, /trains
and /bikes
.
Note: One instance of the plugin is included in the preset. All additional plugin instances will require an id
.