OpenAPITools / OpenAPITools/openapi-generator
While generating Java models from OpenAPI spec (v5.4.0) using openapi-generator-maven-plugin, the Maps in java class are initialized by default to null. How do we prevent this?
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
In OpenAPI v5.4.0 a generated line is
private Map<String, String> extension = null;
In OpenAPI v4.0.3 this line used to be
private Map<String, String> extension = new HashMap();
What is it that has changed and can we go back to what used to happen while using v5.4.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
The issue names openapi-generator-maven-plugin and the generated Java model output; begin by reproducing the result with v5.4.0 and comparing it with v4.0.3. Then inspect the generator configuration and templates or options related to map initialization. Done when the requested non-null initialization is restored through a documented configuration or confirmed generator change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100