Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ktor OpenAPI/Swagger 3 Generator

License

NotificationsYou must be signed in to change notification settings

papsign/Ktor-OpenAPI-Generator

Repository files navigation

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 (seecom.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 theinstall(OpenAPIGen) { ... } section)

Examples

Take a look ata few examples

Who is using it?

And others... (add your name above)

Installation

Gradle

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

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

Step 2. Add the dependency:

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

Git Submodule

Install the submodule:

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

Declare the folder in settings.gradle:

...include'openapigen'

Declare the dependency in the main build.gradle

applyplugin:'kotlin'...dependencies {    compile project(":openapigen")...}

[8]ページ先頭

©2009-2025 Movatter.jp