Skip to content

[BUG][Typescript] Unique array of enum values is handled incorrectly #16458

Closed
@t3hk0d3

Description

@t3hk0d3

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • 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?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Unique Array of Enum properties are not generated properly. Instead of Set<Enum> they are exposed just as Enum:

export class TestRequest {
   'testProperty'?: TestRequestTestPropertyEnum
}

Expected behaviour:

export class TestRequest {
   'testProperty'?: Set<TestRequestTestPropertyEnum>
}
openapi-generator version

7.0.0

OpenAPI declaration file content or url
definitions:
  TestRequest:
    type: object
    properties:
      test_property:
        type: array
        uniqueItems: true
        items:
          type: string
          enum:
            - foo
            - bar
            - baz
            - dar
Generation Details
Steps to reproduce
  1. Generate any typescript client with following set of enums property
  2. Expected generated property type is Set<TestRequestTestPropertyEnum>, but currently it is TestRequestTestPropertyEnum instead
Related issues/PRs

Kinda related issue #14892 (with dead fix PR #15272)

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