OpenAPITools / OpenAPITools/openapi-generator

[REQ] Allow `format` to be used in `instantiationTypes`

Open
#19,803 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

We are using this plugin to generate a Java client shared among out microservices. Sometimes we have fields that should use certain concrete types such as LinkedHashMap.

I initially thought we could make use of the fact that the typeMappings parameter allows for both type and format to be specified to set specific fields. However, this sets the left side of the declaration which (1) results in a compilation error since the right side will still be set to the default HashMap implementation and (2) even if it didn't, I don't want to tie the contract to any specific implementation.

Therefore, I am thinking instantiationTypes should also be able to use the format property so that specific properties can be mapped to different implementations.

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

No file or test path is provided. Start by locating the Java generator handling for typeMappings and instantiationTypes, then trace how type and format are applied to declarations and implementations. Done means instantiationTypes can use format to select a concrete implementation without changing the declared contract.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.