Skip to content

[BUG][JAVA] Unnecessary Jackson imports added to oneOf interface when non-Jackson library is used #21404

Open
@DavidGrath

Description

@DavidGrath

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?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The generator adds unnecessary Jackson imports to a oneOf interface when using retrofit2 and gson, which causes a build error because of the non-existent package

openapi-generator version

7.13.0

OpenAPI declaration file content or url

Reusing oneOf.yaml

Generation Details

Config:

library: 'retrofit2'
useOneOfInterfaces: true

Command:

java -jar openapi-generator-cli.jar generate -g java -i oneOf.yaml -c config.yaml -o out
Steps to reproduce
./gradlew.bat build
Expected output
// Other imports
// No Jackson Imports
public interface Fruit  {
}
Actual output
// Other imports
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

public interface Fruit  {
}
Related issues/PRs
Suggest a fix

PR Incoming

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