Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5600
Closed
Open
Issue created Mar 16, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] Kotlin generator

Created by: jmiettinen

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description
  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 even though schema specifies strings.
  3. In PaymentMethodsRequest we have val additionalData: AnyOfLessThanAdditionalDataCommonCommaAdditionalData3DSecureGreaterThan? = null which tries to be the representation of anyOf. It's clearly wrong as such class does not even exist and actually generated classes AdditionalDataCommon and AdditionalData3DSecure have no connection in it.
openapi-generator version

4.2.3

OpenAPI declaration file content or url

codegen_failure.yaml.zip

Command line used for generation

openapi-generator generate -Dmodels -g kotlin-server -i codegen_failure.yaml -o /tmp/openapi/kotlin-server/

Steps to reproduce
  1. Run command line generation,
  2. Observe that Kotlin classes are invalid Kotlin.
Related issues/PRs
Suggest a fix
  1. Fix Handlebars templates. I think this is done is some issue that I cannot find.
  2. Take in strings instead of an array.
  3. Ideally the case would be represented in Kotlin as a sealed class AnyOfPaymentMethodsRequestAdditionalData with those subclasses.
Assignee
Assign to
Time tracking