OpenAPITools / OpenAPITools/openapi-generator

[REQ] [kotlin-client] Support Enum Fallback Values

Open
#12,970 7 comments 10 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.

When an unknown value of a string pops up to a generated kotlin client, the serialization fails.

A conversation on the general spec is here, but is ongoing.

Various clients have implemented this for reliability sakes. Eg for:

I'm requesting that this be supported for the kotlin generator, which has no such config option

There may be a way to use it, however it is not documented and I'm unable to get it to work.

Describe the solution you'd like

Add an option to allow enum parsing similar to the 3 mentioned above not to fail when finding unknown values. See other client implementations & copy your ideal solution.

Describe alternatives you've considered

A modification to the OpenApi Specification is ongoing in consideration, but the preferred approach is still to have specific clients handle the use case.

Additional context

N/A

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 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java around line 602 and review docs/generators/kotlin.md for existing options. Compare the referenced Java and Dart implementations and the ongoing OpenAPI Specification discussion. Done means the Kotlin generator exposes a documented option for fallback handling of unknown enum values and the generated client no longer fails on them.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.