OpenAPITools / OpenAPITools/openapi-generator
[BUG] [JAVA] [restclient] combining properties and additionalProperties generates broken Model class
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
same as fixed issues:
https://github.com/OpenAPITools/openapi-generator/issues/17361
@JoaoBrlt , we have same problem with java generator and restclient library. Can you fix it please also for restclient? thank you.
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 https://github.com/FasterXML/jackson-databind/issues/3173 this is expected behavior for Jackson so the generated Model is wrong.
This was fixed for the spring generator in https://github.com/OpenAPITools/openapi-generator/pull/11572 but its still happening in the java generator.
openapi-generator version
7.11.0/7.12.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the Java generator's restclient handling with the spring-generator fix in issue #17361 and pull request #11572. Reproduce the case where required properties are combined with additionalProperties: true, then verify that generated models deserialize named properties separately from additional ones and add a regression test for the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100