swagger-api / swagger-api/swagger-codegen
[Kotlin] Reserved word in enum class name is not capitalized
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Problem occurres after generation model from API spec containing reserved word as enum
Swagger-codegen version
❯ swagger-codegen version
3.0.47
Swagger declaration file content or url
swagger: '2.0'
info:
version: 0.0.0
title: Simple API
paths:
/:
get:
responses:
200:
description: OK
definitions:
EnumModel:
type: object
properties:
return:
type: string
enum: [ "1", "0" ]
Command line used for generation
swagger-codegen generate -l kotlin-client -i /swagger/test-spec.yaml
Steps to reproduce
- Run tool for Model generation
- Check generated folder
Related issues/PRs
https://github.com/swagger-api/swagger-codegen/issues/9948
https://github.com/swagger-api/swagger-codegen/issues/6393
Suggest a fix/enhancement
https://github.com/swagger-api/swagger-codegen-generators/pull/1196
Generated Model
The generated result that is caused compilation error and malformed property name in javadoc section
/**
* Simple API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 0.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package ru.tinkoff.bpm.test
/**
*
* @param `return`
*/
data class EnumModel (
val `return`: `return`? = null
) {
/**
*
* Values: _1,_0
*/
enum class `return`(val value: kotlin.String){
_1("1"),
_0("0");
}
}
Complilation error
Malformed javadoc
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 by running the stated swagger-codegen 3.0.47 command with the YAML reproduction and inspect the generated EnumModel. Trace the Kotlin model and enum generation entry point responsible for the reserved return name. Done means the generated Kotlin compiles and the enum name and Javadoc are valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100