OpenAPITools / OpenAPITools/openapi-generator

[REQ] Select a specific media type when generating classes from swagger

Open
#15,253 0 comments 1 reaction 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

I have 2 media type(because of versioning) for a response in my swagger the first "application/v1+json" and the second "application/v2+json" like this :

Screenshot 2023-04-18 at 17 04 37

Screenshot 2023-04-18 at 17 14 33

but when i generate the classes from the swagger i have just the controllerApi for version 2 generated there is no version 1 :

Screenshot 2023-04-18 at 17 11 47

Is there a possibility to choose which media type we want to use , and why we dont have 2 controllers one for each version for example ?

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

Start by reproducing the generation described with the Swagger/OpenAPI document and determine which generator and target language are being used; the issue names no source files, tests, or entry points. Clarify whether the expected result is selecting one media type or generating separate controllers for both versions, then define completion around that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.