OAI / OpenAPI-Specification

The OpenAPI Specification Repository
https://openapis.org
Apache License 2.0
28.81k stars 9.07k forks source link

Kotlin client code generator with `jvm-ktor` library having compile time error #3361

Closed kamal-github closed 1 year ago

kamal-github commented 1 year ago

When we generate client using jvm-ktor library, the generated client is having compile time error.

It passes the extra argument - jsonBlock along with 3 required args with all of the APIs under api/ directory.

    open class AgentPoolApi(
    baseUrl: String = ApiClient.BASE_URL,
    httpClientEngine: HttpClientEngine? = null,
    httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
    ) : ApiClient(baseUrl, httpClientEngine, httpClientConfig, jsonBlock) {
  // redacted
}

But the superclass contract is as below with 3 expected parameters

open class ApiClient(
        private val baseUrl: String,
        httpClientEngine: HttpClientEngine?,
        httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
) {
 // redacted
}

For your information, the gradle task:

plugins {
    // redacted
    id "org.openapi.generator" version "7.0.0"
}

openApiGenerate {
    inputSpec = "api/petstore/api.yaml"
    generatorName = "kotlin"
    outputDir = "$buildDir/generated"
    apiPackage = "petstore.api"
    modelPackage = "petstore.model"
    packageName = "petstore"
    configOptions = [
            library: "jvm-ktor",
            serializationLibrary: "kotlinx_serialization"
    ]
}
darrelmiller commented 1 year ago

This is not the right place for reporting issues with tooling. The OpenAPI Initiative does not produce tooling, just a specification. The OpenAPI Generator project has no affiliation with this organization. They just chose their name poorly.

cobertvc commented 1 year ago
open class AgentPoolApi(
baseUrl: String = ApiClient.BASE_URL,
httpClientEngine: HttpClientEngine? = null,
httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
) : ApiClient(baseUrl, httpClientEngine, httpClientConfig, jsonBlock) {

// redacted }