GitPedia

Ktor OpenAPI Generator

Ktor OpenAPI/Swagger 3 Generator

From papsign·Updated April 23, 2026·View on GitHub·

The Ktor OpenAPI Generator is a library to automatically generate the descriptor as you route your ktor application. The project is written primarily in Kotlin, distributed under the Apache License 2.0 license, first published in 2019. Key topics include: kotlin, ktor, ktor-framework, ktor-openapi-generator, openapi.

Latest release: 0.3-beta.3Added custom converters
June 18, 2022View Changelog →

Ktor OpenAPI Generator


Build

The Ktor OpenAPI Generator is a library to automatically generate the descriptor as you route your ktor application.

Ktor OpenAPI Generator is:

  • Modular
  • Strongly typed
  • Explicit

Currently Supported:

  • Authentication interoperability with strongly typed Principal (OAuth only, see TestServer in tests)
  • Content Negotiation interoperability (see TestServer in tests)
  • Custom response codes (as parameter in @Response)
  • Automatic and custom content Type routing and parsing (see com.papsign.ktor.openapigen.content.type, Binary Parser and default JSON parser (that uses the ktor implicit parsing/serializing))
  • Exception handling (use .throws(ex) {} in the routes with an APIException object) with Status pages interop (with .withAPI in the StatusPages configuration)
  • tags (.tag(tag) {} in route with a tag object, currently must be an enum, but may be subject to change)
  • Spec compliant Parameter Parsing (see basic example)
  • Legacy Polymorphism with use of @DiscriminatorAnnotation() attribute and sealed classes

Extra Features:

  • Includes Swagger-UI (enabled by default, can be managed in the install(OpenAPIGen) { ... } section)

Examples

Take a look at a few examples

Who is using it?

And others... (add your name above)

Installation

Gradle

Step 1. Add the JitPack repository to your build file:

groovy
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }

Step 2. Add the dependency:

groovy
dependencies { implementation 'com.github.papsign:Ktor-OpenAPI-Generator:-SNAPSHOT' }

Git Submodule

Install the submodule:

shell
git submodule add https://github.com/papsign/Ktor-OpenAPI-Generator.git openapigen

Declare the folder in settings.gradle:

groovy
... include 'openapigen'

Declare the dependency in the main build.gradle

groovy
apply plugin: 'kotlin' ... dependencies { compile project(":openapigen") ... }

Contributors

Showing top 12 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from papsign/Ktor-OpenAPI-Generator via the GitHub API.Last fetched: 6/24/2026