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
  • #13395
Closed
Open
Issue created Sep 09, 2022 by Administrator@rootContributor

[Kotlin] Models with "additionalProperties" result in invalid Kotlin code

Created by: jonpeterson

Description

When using the kotlin-spring generator, OpenAPI models including additionalProperties are generated as invalid Kotlin code.

openapi-generator version

5.4.0 and 6.0.1

OpenAPI declaration file content or url
components:
  schemas:
    MyObject:
      type: object
      properties:
        value:
          type: string
      additionalProperties: true
      required:
        - value

...is generated into...

data class MyObject(

    @field:JsonProperty("value", required = true) val `value`: kotlin.String,
) : kotlin.collections.HashMap<String, kotlin.Any>{

}

Note the missing () after kotlin.collections.HashMap<String, kotlin.Any>.

Suggest a fix/enhancement

I'd propose the fix as just adding the missing () to the kotlin-spring's dataClass.mustache file, but I'm not sure if it should be fixed there or in the general Kotlin code for the variable being provided to the template.

Assignee
Assign to
Time tracking