swagger-api / swagger-api/swagger-codegen-generators
Kotlin codegen breaks in multiple ways
Open
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:
- In
DeviceRenderOptions.kt, We haveenum class SdkUiType(val value: kotlin.Array<kotlin.String>)which is probably because of using Handlebars{{ stuff }}instead of{{{ stuff }}}. - In
DeviceRenderOptions.kt, Enum classSdkUiTypetakes in an array instead of a String as an input. - In
PaymentMethodsRequestwe haveadditionalDatawhich is to be one ofAdditionalDataCommonorAdditionalData3DSecure. This maps to empty data class ofAnyOfPaymentMethodsRequestAdditionalDataand into two unrelated data classesAdditionalDataCommonandAdditionalData3DSecure. So this won't compile either. Ideally the case would be represented in Kotlin as a sealed classAnyOfPaymentMethodsRequestAdditionalDatawith those subclasses.
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 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