Kompendium

Welcome to Kompendium, the straight-forward, minimally-invasive OpenAPI generator for Ktor.

How to install

Kompendium publishes all releases to Maven Central. As such, using the release versions of Kompendium is as simple as declaring it as an implementation dependency in your build.gradle.kts

repositories {
mavenCentral()
}

dependencies {
implementation("io.bkbn:kompendium-core:latest.release")
}

In addition to publishing releases to Maven Central, a snapshot version gets published to GitHub Packages on every merge to main. These can be consumed by adding the repository to your gradle build file. Instructions can be found here

Setting up the Kompendium Plugin

Kompendium is instantiated as a Ktor Feature/Plugin. It can be added to your API as follows

private fun Application.mainModule() {
// Installs the Kompendium Plugin and sets up baseline server metadata
install(Kompendium) {
spec = OpenApiSpec(/*..*/)
}
// ...
}

Notarization

The concept of notarizing routes / exceptions / etc. is central to Kompendium. More details on how to notarize your API can be found in the kompendium-core module.

All modules:

Link copied to clipboard

This module houses all annotations that Kompendium uses to provide key metadata when performing reflective analysis.

Link copied to clipboard

This module is responsible for providing wrappers around ktor-auth configuration blocks, allowing users to document their API authentication with minimal modifications to their existing configuration.

Link copied to clipboard

This is where the magic happens. This module houses all the reflective goodness that powers Kompendium.

Link copied to clipboard

Adds support for Ktor Locations API. Any notarized location must be provided with a TParam annotated with @Location. Nested Locations are supported

Link copied to clipboard

This module contains the models that represent the Open Api Specification 3.0 (OAS).

Link copied to clipboard

Contains the code necessary to launch swagger as your documentation frontend.