OpenAPI Support
OpenAPI / Swagger
Available since io.Manager Server 2.0.0
io.Manager offers support for OpenAPI 3.0.0 via Swagger UI.
By default, the Swagger UI can be accessed at route /swagger
.
The Swagger UI is enabled by default and can be configured via the configuration object for initializing the io.Manager Server, or via environment variables, depending on your deployment approach.
Environment Variables
To configure the Swagger UI, register the following environment variables with the proper values:
Environment Variable | Description |
---|---|
API_OPEN_API_ENABLE_SWAGGER_UI |
If true (default), io.Manager will serve the Swagger UI. |
API_OPEN_API_SWAGGER_UI_ROUTE |
Route on which io.Manger will serve the Swagger UI. Defaults to swagger . |
The following example demonstrates configuring the Swagger UI route:
API_OPEN_API_SWAGGER_UI_ROUTE=my-swagger-ui
Configuration Object
To configure the Swagger UI, use the openApi
top-level key of the optional Config
object for initializing the io.Manager Server.
The following example demonstrates how to configure the Swagger UI route:
import { start } from "@interopio/manager";
const config = {
openApi: {
swaggerUIRoute: "my-swagger-ui"
}
};
const server = await start(config);
The openApi
object has the following properties:
Property | Type | Description |
---|---|---|
customSecurityScheme |
object |
SecuritySchemeObject object. If present and if a custom authenticator is used, will be set as the security scheme. This allows making requests via the Swagger UI when custom authentication is used. For more details, see the OpenAPI specification. |
enableSwaggerUI |
boolean |
If true (default), io.Manager will serve the Swagger UI. |
processOpenAPIObject |
function |
Function with the following signature: (doc: OpenAPIObject) => OpenAPIObject . Providing this function enables you to gain full control over the OpenAPI document described by the OpenAPIObject object. |
swaggerCustomOptions |
object |
Partial<SwaggerCustomOptions> object. Custom options for the Swagger UI. This will be merged into an object that will be passed as an argument to the setup() method of the SwaggerModule instance. |
swaggerUIRoute |
string |
Route on which io.Manger will serve the Swagger UI. Defaults to "swagger" . |