swagger-api / swagger-api/swagger-codegen-generators

Kotlin codegen breaks in multiple ways

Open
#630 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Using io.swagger.codegen.v3:swagger-codegen-cli:3.0.18 and kotlin-server code generator, I run into multiple problems with input of codegen_failure.yaml.zip.

Problems:

  1. In DeviceRenderOptions.kt, We have enum class SdkUiType(val value: kotlin.Array<kotlin.String>) which is probably because of using Handlebars {{ stuff }} instead of {{{ stuff }}} .
  2. In DeviceRenderOptions.kt, Enum class SdkUiType takes in an array instead of a String as an input.
  3. In PaymentMethodsRequest we have additionalData which is to be one of AdditionalDataCommon or AdditionalData3DSecure. This maps to empty data class of AnyOfPaymentMethodsRequestAdditionalData and into two unrelated data classes AdditionalDataCommon and AdditionalData3DSecure. So this won't compile either. Ideally the case would be represented in Kotlin as a sealed class AnyOfPaymentMethodsRequestAdditionalData with those subclasses.

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 with the supplied codegen_failure.yaml.zip and the kotlin-server generator templates that produce DeviceRenderOptions.kt and PaymentMethodsRequest. Compare the generated Kotlin with the three reported problems; done means the generated enum compiles with a String value and the additionalData alternatives are represented in a compilable Kotlin model.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.