TegralOpenApiKtor

A Ktor plugin that adds a Tegral OpenAPI DSL integration to the Ktor application, including:

  • Support for providing basic OpenAPI information right from the install(...) { ... } call.

  • Support for describing endpoints and registering operations.

  • Producing an OpenAPI document as an object

  • Support for serving OpenAPI documents from an endpoint

Constructors

Link copied to clipboard

Types

Link copied to clipboard
inner class Configuration : RootDsl

Configuration block for the plugin, allows you to directly add information to the OpenAPI document.

Link copied to clipboard
object Plugin : BaseApplicationPlugin<ApplicationCallPipeline, TegralOpenApiKtor.Configuration, TegralOpenApiKtor>

Ktor plugin object for TegralOpenApiKtor.

Functions

Link copied to clipboard
fun buildOpenApiDocument(): OpenAPI

Create an OpenAPI document from the information registered in this plugin.

Link copied to clipboard

Retrieve all registered hooks for the parents of the given route.

Link copied to clipboard
fun registerOperation(path: String, method: HttpMethod, operation: OperationDsl.() -> Unit)

Register an OpenAPI operation from a path, HTTP method and operation builder.

Link copied to clipboard
fun registerSubrouteHook(route: Route, hook: OperationDsl.() -> Unit)

Register a hook for the given route's children.

Link copied to clipboard
fun withRootBuilder(description: RootDsl.() -> Unit)

Runs the given lambda against the root OpenAPI builder, allowing to further customize the content of the OpenAPI document.