Skip to content

jakobkmar/kotlin-openapi-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2de9916 · Apr 7, 2022

History

41 Commits
Apr 7, 2022
Mar 21, 2022
Apr 7, 2022
Apr 7, 2022
Mar 21, 2022
Apr 7, 2022
Mar 21, 2022
Apr 7, 2022
Mar 21, 2022
Mar 21, 2022
Mar 21, 2022
Mar 26, 2022
Apr 7, 2022

Repository files navigation

kotlin-openapi-generator

A not yet feature complete client generator.

Features:

  • generates 100% Kotlin multiplatform code
  • does not generate any useless classes, tries to be as clean as possible
  • supports OpenAPI object inheritance (allOf)

Dependency

This is a personal project for my own use cases, however if you think it is useful for you too, you can use it as a library or via the Gradle plugin:

Gradle plugin:

plugins {
    id("net.axay.openapigenerator") version "$version"
}

or as a Library:

dependencies {
    implementation("net.axay:openapigenerator:$version")
}

Both are available on mavenCentral(), and the Gradle plugin is also available on the gradlePluginPortal().

Usage

Gradle plugin

Example for how to register a generation task:

tasks {
    register<OpenApiGenerateTask>("generateFromYourSpec") {
        specUrl.set("https://urltoyourspec.json") // you can also use 'specFile'
        outputDirectory.set(file("src/commonMain/kotlin/"))
        packageName.set("your.package.name")
        // optionally: deleteOldOutput.set(true)
        // this requires extra care, because it recursively deletes the output directory
    }
}

All properties for the OpenApiGenerateTask can be found here.

Library

Have a look at how the Gradle plugin uses the library.


If you modify this project, please respect the AGPL-3.0 License.

About

A clean OpenAPI client generator for Kotlin multiplatform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages