swagger-api / swagger-api/swagger-codegen

[Kotlin] enums should be uppercase

Open
#7,466 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

In Kotlin enums should be uppercased, its not directly a rule in Kotlin to have enums in uppercase but all examples used in Kotlin documentation is uppercased.

See here https://kotlinlang.org/docs/reference/coding-conventions.html#property-names and https://kotlinlang.org/docs/reference/enum-classes.html

Swagger-codegen version

2.3.1

Steps to reproduce

I dupliacted integrationtests for scala in /swagger-codegen/modules/swagger-codegen/src/test/resources/integrationtests/scala and created kotlin test, and then I ran /swagger-codegen/modules/swagger-codegen/src/test/resources/integrationtests/kotlin/required-attributes.sh

Related issues/PRs

Related to #5769

Suggest a fix/enhancement
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase;

in KotlinClientCodegen.java should be changed to

protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.UPPERCASE;

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 in KotlinClientCodegen.java and inspect the enumPropertyNaming setting. Run modules/swagger-codegen/src/test/resources/integrationtests/kotlin/required-attributes.sh and compare the generated enum names with the Kotlin conventions cited in the issue. Done means the Kotlin integration test produces uppercase enum names.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.