openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG] Kotlin generated class for `type: object` with `additionalProperties` does not compile

Open tbvh opened this issue 2 years ago • 1 comments

Description

OpenApi allows to define an open ended object (map). When generating Kotlin code for it, the class declaration contains a compile error. data class Metadata(...) : kotlin.collections.HashMap<String, kotlin.String>{ is generated, but it should be: data class Metadata(...) : kotlin.collections.HashMap<String, kotlin.String>(){.

openapi-generator version

6.0.0 / 6.0.1

OpenAPI declaration file content or url

Spec:

components:
  schemas:
    Metadata:
      type: "object"
      properties:
        customerIp:
          type: "string"
      additionalProperties:
        type: "string"
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

tbvh avatar Jul 04 '22 09:07 tbvh

Issue still exists in latest 6.2.0 version. It is problematic because I needed use .openapi-generator-ignore file and ignore some types during generating and later build it manually.

Stiuil06 avatar Oct 10 '22 13:10 Stiuil06