Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/papsign/Ktor-OpenAPI-Generator
Ktor OpenAPI/Swagger 3 Generator
https://github.com/papsign/Ktor-OpenAPI-Generator
kotlin ktor ktor-framework ktor-openapi-generator openapi openapi-generator swagger swagger-ui
Last synced: 29 days ago
JSON representation
Ktor OpenAPI/Swagger 3 Generator
- Host: GitHub
- URL: https://github.com/papsign/Ktor-OpenAPI-Generator
- Owner: papsign
- License: apache-2.0
- Created: 2019-05-11T15:19:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-18T22:07:14.000Z (over 2 years ago)
- Last Synced: 2023-10-20T22:16:05.027Z (about 1 year ago)
- Topics: kotlin, ktor, ktor-framework, ktor-openapi-generator, openapi, openapi-generator, swagger, swagger-ui
- Language: Kotlin
- Homepage:
- Size: 440 KB
- Stars: 230
- Watchers: 8
- Forks: 42
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ktor - Ktor OpenAPI Generator
- awesome-ktor - Ktor OpenAPI Generator
README
# Ktor OpenAPI Generator
[![](https://jitpack.io/v/papsign/Ktor-OpenAPI-Generator.svg)](https://jitpack.io/#papsign/Ktor-OpenAPI-Generator)
[![Build](https://github.com/papsign/Ktor-OpenAPI-Generator/workflows/Build/badge.svg)](https://github.com/papsign/Ktor-OpenAPI-Generator/actions)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
- ExplicitCurrently 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 classesExtra Features:
- Includes Swagger-UI (enabled by default, can be managed in the `install(OpenAPIGen) { ... }` section)## Examples
Take a look at [a few examples](https://github.com/papsign/Ktor-OpenAPI-Generator/wiki/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")
...
}
```