Skip to content

[BUG] 7.21.0 -> 7.22.0: broken Gradle plugin #23658

@rlnt

Description

@rlnt

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The generator Gradle plugin seems to be broken after updating to 7.22.0.

I am using the Gradle plugin in my setup and the configuration looks like this:

openApiGenerate {
    generatorName = "kotlin"
    inputSpec = openApiSpecFile.map { it.asFile.path }
    templateDir = "${rootDir.absolutePath}/.openapi/templates"
    outputDir = layout.buildDirectory.dir("generated/openapi")
        .map { it.asFile.path }
    typeMappings.putAll(
        mapOf(
            "kotlinx.datetime.Instant" to "kotlin.time.Instant",
            "number+decimal" to "Deci",
            "string+timePeriod" to "TimePeriod"
        )
    )
    importMappings.putAll(
        mapOf(
            "kotlinx.datetime.Instant" to "kotlin.time.Instant",
            "Deci" to "org.kimplify.deci.Deci",
            "TimePeriod" to "$appId.domain.model.type.TimePeriod"
        )
    )
    packageName = "${appId}.openapi"
    generateModelTests = false
    generateApiTests = false
    // cleanupOutput = true
    configOptions = mapOf(
        "dateLibrary" to "kotlinx-datetime",
        // "enumPropertyNaming" to "UPPERCASE", currently bugged in Generator
        "library" to "multiplatform",
        "omitGradlePluginVersions" to "true",
        "omitGradleWrapper" to "true",
        // currently bugged, produces double serializable annotations, automatically set with "library" to "multiplatform"
        // https://github.com/OpenAPITools/openapi-generator/issues/18904
        // "serializationLibrary" to "kotlinx_serialization",
        "sourceFolder" to "commonMain/kotlin"
    )
}

The Gradle file uses the Kotlin DSL. After updating, the project Gradle sync fails because values can no longer be applied to the OpenApiGenerate configuration block. Here is the full log:
https://gist.github.com/rlnt/a9262e1b451f1bd034bf52bf6d5a03b3

openapi-generator version

7.22.0

OpenAPI declaration file content or url

/

Generation Details

Generation is invoked via the Gradle plugin by a Gradle task.

Related issues/PRs

Didn't find any.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions