Skip to content

[BUG] [JAVA] Referencing Object with additionalPorperties does not import HashMap in Model #3456

@FloKaemmerer

Description

@FloKaemmerer

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Generating Model for a Object that references an object that has "additionalProperties" fails to generate the import for HashMap

openapi-generator version

affected Version(s): 4.0.0 to 4.0.3
Not affected: 3.3.4 (sets the field to null, so no import is needed here)

OpenAPI declaration file content or url

Snipped:

    WithAdditinalPropertiesDTO:
      type: object
      properties:
        id:
          type: string
      additionalProperties: {}

    BrokenDTO:
      type: object
      properties:
        id:
          type: string
        withAdditinalProperties:
          $ref: '#/components/schemas/WithAdditinalPropertiesDTO'

gist: https://gist.github.com/FloKaemmerer/54a9663183688b0d5658a8064c32f695

Command line used for generation

mvn clean compile

used pom: https://gist.github.com/FloKaemmerer/9789a0fc5bfca47b6c4cf50c7573434b

Steps to reproduce
Related issues/PRs
Suggest a fix

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