Generate Swagger Client Model and API as Modules

Viewed 203

Is it possible to generate a swagger client as a multi-module project?

I want the model to be one artifact and the api to be separate and depend on the model module. e.g.

- client
    - model
        - build.gradle
    - api
        - build.gradle
    - build.gradle

If I generate like this the model and api are only separated by package

java -DmodelDocs=false -DapiDocs=false -DapiTests=false -jar swagger-codegen-cli.jar generate -i swagger.json -l java -c config.json -o client

If I run the command twice I can generate them in separate directories but then I have to manually edit the build files by creating a parent in the root and referencing the model as a dependency of the api.

java -DmodelDocs=false -DapiDocs=false -Dmodels -DsupportingFiles -jar swagger-codegen-cli.jar generate -i swagger.json -l java -c config.json -o client/model
java -DmodelDocs=false -DapiDocs=false -Dapis -DapiTests=false -DsupportingFiles -jar swagger-codegen-cli.jar generate -i swagger.json -l java -c config.json -o client/api

The build files are part of the supportingFiles. Can they be customised with a template (in a similar way that the language generators can) to achieve this?

0 Answers
Related