OpenAPITools / OpenAPITools/openapi-generator

[REQ] Polymorphism with `sealed class` (Kotlin)

Open
#8,059 1 comment 27 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

Currently, the generated model is using inheritance based on an interface.

Describe the solution you'd like

Add a flag to the Gradle script which allows generating a sealed class.

Additional context

Maybe this feature can be expanded to more languages.

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 reviewing the Gradle script and the generated Kotlin model that currently uses an interface. Determine how a flag should select sealed-class generation and verify that generated models use the requested form; the issue does not name specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.