OpenAPI HTTP APIs
HTTP API documentation specified by OpenAPI can be rendered using the docusaurus-openapi-docs plugin.
Examples:
Plugin Configuration
Follow the plugin installation and configuraiton instructions. As an example you can also refer to a diff adding the plugin to an existing site.
Reitit routes
Reitit router library has OpenAPI support and is able to generate spec which can be rendered as documentation.
Example:
⚠️ Warning: Using requiring-resolve
to access route data will result in code being evaluated, therefore it only needs to be run on trusted sources!
Plugin comparison
There are other plugins for Docusaurus that render OpenAPI spec. Here is a brief overview:
- docusaurus-openapi-docs
- This is the one chosen in the examples above.
- Good default look, shows HTTP method badges in the sidebar.
- redocusaurus
- Wraps redoc to be embedded inside Docusarus.
- It seems to work well and supports many features, but it has a slightly different look from Docusaurus, it looks a bit out of place.
- docusaurus-openapi
- It looks a bit too plain compared to the other plugins