[Java jersey2] Generated code fails to compile when additionalProperties is set
Created by: sebastien-rosset
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
When a schema has additionalProperties
set, the generated Java + jersey2 code has new HashMap<>()
, where the K, V pair is missing.
For example:
private TamSeverity severity = new HashMap<>();
[ERROR] ..../client/model/TamAdvisory.java:[95,44] error: incompatible types: cannot infer type arguments for HashMap<>
[ERROR] reason: no instance(s) of type variable(s) K,V exist so that HashMap<K,V> conforms to TamSeverity
[ERROR] where K,V are type-variables:
[ERROR] K extends Object declared in class HashMap
[ERROR] V extends Object declared in class HashMap
openapi-generator version
master May 12 with new jersey2 library.
OpenAPI declaration file content or url
tam.Severity:
x-allOf-name: tam.Severity
allOf:
- $ref: '#/components/schemas/mo.BaseComplexType'
additionalProperties: true