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
constructor()

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.

Properties

Link copied to clipboard

The context used by this plugin. This can be used to register new types.

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, operationBuilder: OperationBuilder)

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

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

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

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.