swagger-api / swagger-api/swagger-codegen
[Kotlin] enums should be uppercase
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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