openAPI

fun Route.openAPI(path: String, swaggerFile: String, block: OpenAPIConfig.() -> Unit = {}): Route(source)

Creates a get endpoint at path with documentation rendered from the OpenAPI file.

This method tries to lookup swaggerFile in the resources first, and if it's not found, it will try to read it from the file system using File.

The documentation is generated using StaticHtml2Codegen by default. It can be customized using config in block. See OpenAPIConfig for more details.

If source is supplied inside the config block, the swaggerFile argument will take precedence.

Report a problem

Parameters

path

The base path where the OpenAPI UI will be accessible.

swaggerFile

The path to the OpenAPI file.

block

A configuration block to apply additional OpenAPI configuration settings.


fun Route.openAPI(path: String, block: OpenAPIConfig.() -> Unit = {}): Route(source)

Creates a get endpoint at path with documentation rendered from the OpenAPI file.

This method uses the configured OpenAPIConfig.source to resolve the OpenAPI specification.

The documentation is generated using StaticHtml2Codegen by default. It can be customized using config in block. See OpenAPIConfig for more details.

Report a problem

Parameters

path

The base path where the OpenAPI UI will be accessible.

block

A configuration block to apply additional OpenAPI configuration settings.