Skip to content

[BUG][JAVA] Model generation of array with uniqueItems=true is not working #18102

@MelleD

Description

@MelleD

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

Currently no more sets are generated if uniqueItems=true is set.

openapi-generator version

7.4.0/latest

OpenAPI declaration file content or url

If you post the code inline, please wrap it with

        stringSet:
          type: array
          uniqueItems: true
          items:
            type: string
        stringDefaultSet:
          type: array
          uniqueItems: true
          default:
            - A
            - B
          items:
            type: string
        stringEmptyDefaultSet:
          type: array
          uniqueItems: true
          default: []
          items:
            type: string

Out put is

  @Valid
  private List<String> stringSet = new ArrayList<>();

  @Valid
  private List<String> stringDefaultSet = new ArrayList<>(Arrays.asList("A", "B"));

  @Valid
  private List<String> stringEmptyDefaultSet = new ArrayList<>();
Generation Details

Spring Boot Cloud

Steps to reproduce

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