swagger-api / swagger-api/swagger-codegen

[JAVA] Support generating client with multi-version models.

Open
#9,735 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I am trying to generate a single Java client with multiple-version models. My models are like this:

configuration
  |_ myapi
    |_ v1
      |_ my_fully_compliant.yaml
    |_ v2
      |_ my_fully_compliant.yaml

The my_fully_compliant.yaml contains configurations for all data models I will be using, but in different versions.

What I want is to generate a single Java client package that contains:

my.api
  |_ v1
    |_ client
      |_ MyClient.java
    |_ models
      |_ SomeDataModel.java
  |_ v2
    |_ client
      |_ MyClient.java
    |_ models
      |_ SomeDataModel.java

So that I can do use different version of SomeDataModel in the MyClient when sending requests to the API!

Swagger-codegen version

Swagger-codegen-cli = 3.x

Command line used for generation

language = spring
openapi = 3.0.2

Suggest a fix/enhancement

Suggest to enhance generating java client with multi-version models.

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 tracing the Java/Spring generation path for the provided OpenAPI 3.0.2 definition and how package and model names are configured. Compare the requested v1/v2 layout with the generated output; done means one client package contains separate versioned clients and models. No source file or test is named, so confirm scope and testing expectations with maintainers.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.