swagger-api / swagger-api/swagger-codegen

[Kotlin] enum generation

Open
#9,790 1 comment 2 reactions 1 assignee View on GitHub

@HugoMario is already working on this.

Since Mar 26, 2023.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I am generating kotlin data classes from a swagger.json file.
among others there are enums to generate.

Unfortunately java and kotlin-client languages seem to duffer using the same enumPropertyNaming="UPPERCASE"

Swagger-codegen version

io.swagger.codegen.v3:swagger-codegen-cli:3.0.13

Swagger declaration file content or url

In this zip you can fing the sample.json swagger file and the swagger-config.json as well as the Outputs for java and kotlin-client
files.zip

Command line used for generation

I used the gradle swagger codegen plugin

Steps to reproduce

when using language"java" with enumPropertyNaming="UPPERCASE", it does the correct conversion.
SOME_ENUM -> SOME_ENUM
some other enum -> SOME_OTHER_ENUM

But when I use the same thing with language kotlin-client, I get a different outcome:
SOME_ENUM -> SOMEENUM <- I would expect the value from the java language
some other enum -> SOME_OTHER_ENUM

I would expect the same outcome as I get when using the java language though.

Suggest a fix/enhancement

Not sure how to fix it, but as I said above I would expect the languages to behave the same way.

Is there maybe a known workaround for this? E.g. use a different version of the codegen-cli?

Many thanks

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.