swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.02k stars 6.03k forks source link

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

Open Jinyi-Li opened 5 years ago

Jinyi-Li commented 5 years ago
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.

RabihHallage commented 1 year ago

+1 ... any workarounds for the time being?