A clean OpenAPI client generator for Kotlin multiplatform

Overview

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.

You might also like...
Multiplatform HTTP-Client implementation using Ktor

Kotlin Multiplatform HTTP-Client using Ktor Simple demonstration of a Ktor-based multiplatform HTTP-client in Kotlin Overview base submodule: common c

KTor-Client---Android - The essence of KTor Client for network calls

KTor Client - Android This project encompasses the essence of KTor Client for ne

Mocking for Kotlin/Native and Kotlin Multiplatform using the Kotlin Symbol Processing API (KSP)

Mockative Mocking for Kotlin/Native and Kotlin Multiplatform using the Kotlin Symbol Processing API (KSP). Installation Mockative uses KSP to generate

Clean Android multi-module offline-first scalable app in 2022. Including Jetpack Compose, MVI, Kotlin coroutines/Flow, Kotlin serialization, Hilt and Room.

Android Kotlin starter project - 2022 edition Android starter project, described precisely in this article. Purpose To show good practices using Kotli

Kotlin-phoenix - A set of tools aimed to bridge Phoenix with the Kotlin Multiplatform world

Kotlin Phoenix This project is aimed to allow developers to work with Phoenix Ch

FlowExt is a Kotlin Multiplatform library, that provides many operators and extensions to Kotlin Coroutines Flow

FlowExt | Kotlinx Coroutines Flow Extensions | Kotlinx Coroutines Flow Extensions. Extensions to the Kotlin Flow library | kotlin-flow-extensions | Coroutines Flow Extensions | Kotlin Flow extensions | kotlin flow extensions | Flow extensions

MMKV for Kotlin Multiplatform is a wrapper for MMKV using Kotlin API

MMKV for Kotlin Multiplatform is a wrapper for MMKV using Kotlin API

KataContacts written in Kotlin. The main goal is to practice Clean Architecture Development

KataContacts written in Kotlin We are here to practice Clean Architecture Development. Clean Architecture is a way of structuring code. We are going t

A clean architecture example. Using Kotlin Flow, Retrofit and Dagger Hilt, etc.
A clean architecture example. Using Kotlin Flow, Retrofit and Dagger Hilt, etc.

android-clean-architecture A clean architecture example. Using Kotlin Flow, Retrofit and Dagger Hilt, etc. Intro Architecture means the overall design

Releases(0.1.2)
  • 0.1.2(Apr 7, 2022)

    Kotlin OpenAPI Generator Gradle Plugin 0.1.2

    The initial working release of the Gradle plugin. Allows to generate schemas to a specific directory, supports JSON and YAML specs and can resolve specs from URLs.

    Source code(tar.gz)
    Source code(zip)
Owner
Jakob K
I use Kotlin and do a lot of Minecraft modding. Working on pacmc.
Jakob K
HQ OpenAPI Specification and Client & Server SDK Generators

HQ-API HQ OpenAPI Specification and Client & Server SDK Generators Cloning Github Repository Get access to Flocktory team in Github Adding a new SSH k

Flocktory Spain, S.L. 1 Sep 2, 2022
🐨 koa - Kotlin and Ktor OpenAPI

Koa intends to be a fully functional DSL for OpenAPI in Kotlin, including a Ktor plugin to add OpenAPI to your server Kotlin applications.

Zoroark 14 Dec 31, 2022
Kotlin DTO generator for Protobuf Messages

Kotlin DTO Generator for gRPC The protobuf plugin generates DTO classes for the corresponding messages in your *.proto files. The data classes in Kotl

Vlasov Artem 1 Nov 9, 2021
A metadata generator intended for the Android source tree

Metalava (Also known as "doclava2", but deliberately not named doclava2 since crucially it does not generate docs; it's intended only for metadata ext

null 0 Nov 17, 2021
Gradle plugin for Hugo static site generator

gradle-hugo-plugin Wrapper for Hugo static site generator. The plugin provides a declarative approach for the Hugo binary used to build the static sit

François Staudt 10 Jun 28, 2022
Event State Processor Generator plugin is compatible with IntelliJ and Android Studio.

Event State Processor Generator plugin is compatible with IntelliJ and Android Studio. It provides source code generation for the EventStateProcessor Library to increase code productivity in Flutter apps development.

Extreme Vietnam Public 2 Dec 7, 2021
A korge map generator for Pocket Palm Heroes remastered

Korge mapgen This is a korge map generator for Pocket Palm Heroes remastered. Algorithm Is based mostly on this presentation by Gus Smedstad, who is t

Alexey Kononov 4 Sep 6, 2022
This simple project will consist of an endless cat fact generator

MVVM is a structural design pattern and its based on the separation of the project structure into 3 main components: The Model, which is responsible f

Chinmay Deshpande 0 Dec 15, 2021
Integration Testing Kotlin Multiplatform Kata for Kotlin Developers. The main goal is to practice integration testing using Ktor and Ktor Client Mock

This kata is a Kotlin multiplatform version of the kata KataTODOApiClientKotlin of Karumi. We are here to practice integration testing using HTTP stub

Jorge Sánchez Fernández 29 Oct 3, 2022
Mobile client for official Nextcloud News App written as Kotlin Multiplatform Project

Newsout Android and iOS mobile client for Nextcloud news App. The Android client is already available to download in the Play Store. F-Droid and Apple

Simon Schubert 118 Oct 3, 2022