https://github.com/jakobkmar/kotlin-openapi-generator
A clean OpenAPI client generator for Kotlin multiplatform
https://github.com/jakobkmar/kotlin-openapi-generator
Last synced: 2 months ago
JSON representation
A clean OpenAPI client generator for Kotlin multiplatform
- Host: GitHub
- URL: https://github.com/jakobkmar/kotlin-openapi-generator
- Owner: jakobkmar
- License: agpl-3.0
- Created: 2022-03-24T23:39:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-07T14:36:20.000Z (about 3 years ago)
- Last Synced: 2025-04-23T13:02:47.294Z (2 months ago)
- Language: Kotlin
- Size: 143 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## 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:**
```kotlin
plugins {
id("net.axay.openapigenerator") version "$version"
}
```or as a **Library:**
````kotlin
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:
````kotlin
tasks {
register("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](https://github.com/jakobkmar/kotlin-openapi-generator/blob/main/openapigenerator-gradle-plugin/src/main/kotlin/net/axay/openapigenerator/OpenApiGenerateTask.kt).###
**Library**
Have a look at
[how the Gradle plugin uses the library](https://github.com/jakobkmar/kotlin-openapi-generator/blob/main/openapigenerator-gradle-plugin/src/main/kotlin/net/axay/openapigenerator/OpenApiGenerateTask.kt#L60).___
If you modify this project, please respect the AGPL-3.0 License.