Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Kotlin] Reserved word in enum class name is not capitalized #12243

Open
atarynin opened this issue Oct 11, 2023 · 0 comments
Open

[Kotlin] Reserved word in enum class name is not capitalized #12243

atarynin opened this issue Oct 11, 2023 · 0 comments

Comments

@atarynin
Copy link

atarynin commented Oct 11, 2023

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

#9948
#6393

Suggest a fix/enhancement

swagger-api/swagger-codegen-generators#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
image
Malformed javadoc
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant