openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG][Kotlin/Gradle] Unknown library: jvm-spring-webclient in kotlin Generator

Open kevelopment opened this issue 3 years ago • 3 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [ ] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [x] What's the actual output vs expected output? -> either the docs should not show this option or the library should work
Description

When using the OpenApi Generator (v 6.6.0) to generate a kotlin client using the config option library set to jvm-spring-webclient the generation throws an error:

Caused by: java.lang.RuntimeException: Unknown library: jvm-spring-webclient
Available libraries:
  jvm-ktor
  jvm-okhttp4
  jvm-okhttp3
  jvm-retrofit2
  multiplatform
  jvm-volley
  jvm-vertx
	at org.openapitools.codegen.DefaultCodegen.setLibrary(DefaultCodegen.java:6008)
	at org.openapitools.codegen.languages.AbstractKotlinCodegen.processOpts(AbstractKotlinCodegen.java:518)
	at org.openapitools.codegen.languages.KotlinClientCodegen.processOpts(KotlinClientCodegen.java:371)
	at org.openapitools.codegen.DefaultGenerator.configureGeneratorProperties(DefaultGenerator.java:256)
	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:935)
	at org.openapitools.generator.gradle.plugin.tasks.GenerateTask.doWork(GenerateTask.kt:841)
	... 

Stating that the option jvm-spring-webclient does not exist even though it is shown as option here: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/kotlin.md

openapi-generator version

v 6.6.0

OpenAPI declaration file content or url

This issue is not related to the content of an OpenAPI file. Reproducible with any openapi spec.

Generation Details

Important config flags to reproduce this issue:

generatorName = "kotlin"

configOptions = {
  "library": "jvm-spring-webclient",
  "packageName": "generated",
  "groupId": "com.package.example"
}
Steps to reproduce

Minimal Spec to reproduce the issue:

  • take any kind of openapi specification
  • create a build.gradle.kts with the following configuration:
tasks.register<GenerateTask>("generateKotlinClient") {
    generatorName.set("kotlin")
    outputDir.set("$projectDir/src/main/kotlin")
    inputSpec.set("$rootDir/path/to/api/spec.yml")
    configOptions.set(
        mapOf(
            // this is the line that causes the issue
            "library" to "jvm-spring-webclient",
            "collectionType" to "list",
            "enumPropertyNaming" to "UPPERCASE",
            "packageName" to "generated",
            "groupId" to "com.test.openapi",
        ),
    )
}
  • run ./gradlew generateKotlinClient
  • see Unknown library: jvm-spring-webclient error
Related issues/PRs

Couldn't find any.

Suggest a fix

My guess is that the Feature is not yet included in v6.6.0 but the Docs are showing the current state of main already? 🤔 i.e. the docs are showing a feature that is not yet enabled / enrolled

kevelopment avatar Jun 01 '23 10:06 kevelopment

Hi @kevelopment. The new library for kotlin is not included in 6.6.0 just yet. It will be included in the next release, scheduled to be released in June. The documentation is based on the master branch, not on 6.6.0. Sorry for the confusion. Edit: you could circumvent this by using the 7.0.0-SNAPSHOT version.

stefankoppier avatar Jun 02 '23 06:06 stefankoppier

Hey Ho @stefankoppier, thanks for your swift reply! I'll take the wait until 7.0.0 then 😊 Are there any plans to have a minor release e.g. 6.7.0 before reaching the next major milestone?

Guess this Issue can be closed then.

kevelopment avatar Jun 02 '23 08:06 kevelopment

Are there any plans to have a minor release e.g. 6.7.0 before reaching the next major milestone?

Nope. v7.0.0 will be next release.

wing328 avatar Jun 02 '23 08:06 wing328