OpenAPITools / OpenAPITools/openapi-generator

[BUG] [Kotlin] Parcelize makes the build fail

Open
#14,939 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
Description

Hello I am using the openapi generator gradle plugin with version 6.4 and the following build.gradle.kts properties.
The generated project is not able to build, because the android extension is missing.

The problem is that parcelize Models requires android, when I disable the parcelizeModels Option the generated project builds.

Failed to apply plugin 'kotlin-parcelize'.
   > Extension with name 'android' does not exist. Currently registered extension names: [ext, kotlin, kotlinTestRegistry, base, defaultArtifacts, sourceSets, reporting, java, javaToolchains, testing]
openapi-generator version

I am using Openapi Generator Version 6.4

OpenAPI declaration file content or url

build.gradle.kts

openApiGenerate {
    artifacts {
        id.set("my-module")
        groupId.set("com.mygroup")
    }
    generatorName.set("kotlin")
    configOptions.set(
        mapOf(
            "supportAndroidApiLevel25AndBelow" to "true",
            "useCoroutines" to "true",
            "library" to "jvm-retrofit2",
            "parcelizeModels" to "true",
            "modelMutable" to "true",
            "enumPropertyNaming" to "original",
        ),
    )
    inputSpec.set("$rootDir/openapi.json")
    outputDir.set("$rootDir/build/generated/api")
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the build.gradle.kts openApiGenerate configuration and reproduce generation with library jvm-retrofit2, supportAndroidApiLevel25AndBelow, and parcelizeModels enabled. Compare the generated project's build with parcelizeModels disabled; done means the generated project builds successfully while parcelizeModels remains enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
api, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.