Bug Report Checklist
Description
Combining required properties with additionalProperties: true generates a Model class that extends HashMap. On deserialization, the given Properties are not filled, instead all properties (required and additional) are part of the Hashmap. According to FasterXML/jackson-databind#3173 this is expected behavior for Jackson so the generated Model is wrong.
This was fixed for the spring generator in #11572 but its still happening in the java generator.
openapi-generator version
7.1.0
OpenAPI declaration file content or url
additionalPropertiesWithRequiredData:
type: object
additionalProperties: true
properties:
propA:
type: integer
format: int64
propB:
type: string
required:
- propA
- propB
Related issues/PRs
#1466
#11572
Suggest a fix
The model generation should not extend HashMap, instead put additionalProperties as a HashMap inside the class and annotate it with @JsonAnySetter / @JsonAnyGetter.
Bug Report Checklist
Description
Combining required properties with additionalProperties: true generates a Model class that extends HashMap. On deserialization, the given Properties are not filled, instead all properties (required and additional) are part of the Hashmap. According to FasterXML/jackson-databind#3173 this is expected behavior for Jackson so the generated Model is wrong.
This was fixed for the spring generator in #11572 but its still happening in the java generator.
openapi-generator version
7.1.0
OpenAPI declaration file content or url
Related issues/PRs
#1466
#11572
Suggest a fix
The model generation should not extend HashMap, instead put additionalProperties as a HashMap inside the class and annotate it with
@JsonAnySetter/@JsonAnyGetter.