Skip to content

[BUG][KOTLIN] Generated enum does not compile if type mapping is not defined #22425

@jbardel

Description

@jbardel

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

The Kotlin generated code does not compile if the type mapping is not explicitly defined, or if it is explicitly set to BigDecimal. By default, the generator uses String to construct the enum.

openapi-generator version

7.17.0

OpenAPI declaration file content or url
openapi: 3.0.0
paths:
  '/':
    get:
      operationId: operation
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelWithEnumBigDecimalValue'
components:
  schemas:
    ModelWithEnumBigDecimalValue:
      properties:
        mode:
          type: number
          enum:
            - -1
            - 0
            - 1.1
            - 0.4

this results to this error :

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions