OpenAPITools / OpenAPITools/openapi-generator

[BUG] JAVA Spring HashMap is assigned to Object 4.0.0-beta3

Open
#2,673 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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 4.0.0 beta3?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Generation of complex real-world third party API has multiple issues. In 3.3.4 we could work around them but in 4.0.0-beta3 at least one issue is blocking.

This is an example of the generated code that fails to compile.
If you'd like a small test case I can extract it but I thought you might be interested to see the full generation.

  @JsonProperty("_links")
  private LinksAll links = new HashMap<>();

in 3.3.4 this was set to null and so was OK..

I made a skeleton of the application build here.
https://github.com/mjeffrey/psd2

openapi-generator version

4.0.0 beta-3. Regression from 3.3.4

OpenAPI declaration file content or url

https://github.com/mjeffrey/psd2/tree/master/src/main/resources/openapi

Command line used for generation

https://github.com/mjeffrey/psd2/blob/master/pom.xml

Java 8, swagger-core 1.5.22

Steps to reproduce

check out and build the project https://github.com/mjeffrey/psd2 and build with
mvnw clean install

This is the output from the build for each version.
https://github.com/mjeffrey/psd2/blob/master/mvn-4.0.0-beta3.txt
regression from
https://github.com/mjeffrey/psd2/blob/master/mvn-3.3.4.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking out the linked psd2 reproduction and its pom.xml, then run mvnw clean install to confirm the Java generation failure. Compare the generated model and the mvn-4.0.0-beta3.txt and mvn-3.3.4.txt outputs, then trace the generator path producing the _links field; done means the generated Java compiles without regressing the 3.3.4 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.