OpenAPITools / OpenAPITools/openapi-generator

[BUG] Generation with `kotlinx_serialization` generates unnecessary `@Serializable` on interfaces and double `@Serializable@Serializable` on classes

Open
#18,904 4 comments 3 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

Kotlin Client
openapi generator version 7.6.0

Description

Generated interfaces have @Serializable and classes @Serializable@Serializable annotations which requires manual correction.

openapi-generator version

7.6.0

Steps to reproduce

My gradle task uses this to generate:

    generatorName.set("kotlin")
    library.set("multiplatform")
    inputSpec.set("path/to/my/openapi-spec.json")
    outputDir.set("$projectDir/build")
    ....
    configOptions.set(
        mapOf(
            "serializationLibrary" to "kotlinx_serialization",
            "dateLibrary" to "kotlinx-datetime",
            "idea" to "true",
           ....

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 by reproducing the Kotlin client generation with the multiplatform library and kotlinx_serialization configuration shown in the issue, then inspect the generated interfaces and classes. Done means interfaces no longer receive an unnecessary @Serializable annotation and classes do not contain the annotation twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
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.