Skip to content

GecseA/gecsevar-openapi

Repository files navigation

my workflow Maven Central

gecsevar-openapi

Yet Another Custom Open API generator (probably ;)

Features:

kotlin-ktor-server

  • model
  • api (Route.XXX and interface)

kotlin-multiplatform-client (mobile Android & iOS related)

  • model
  • api (client Http calls)

How to use

Simply add a task to your gradle build config like: (builds are in the central repo)

kotlin {
    jvmToolchain(21)

    sourceSets {
        getByName("main").kotlin.srcDirs("${layout.buildDirectory.get()}/generated/my")
    }
}

buildscript {
    dependencies {
        classpath("hu.gecsevar:gv-openapi")
    }
}

tasks.create("openApiGenerate" + "MyApi", GenerateTask::class.java) {
    generatorName.set("gv-ktor-server")
    inputSpec.set("$rootDir/src/main/resources/my-awesome.yaml")
    outputDir.set("${layout.buildDirectory.get()}/generated/")
    apiPackage.set("my.domain.api")
    modelPackage.set("my.domain.schemas")
    //optional nameMappings.set(mutableMapOf("challenge_ts" to "challenge_ts"))    // _ REPLACED TO underscore IF NOT MAPPED
}

tasks.compileKotlin {
    dependsOn("openApiGenerateMyApi")
}

About

Open-API code generator for kotlin projects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published