Swagger-codegen gradle version

Viewed 68

I am using swagger-codegen to build an API client in java. Swagger-codegen generates an output using an old gradle version and a grade.build file I manually edit to remove some things so it will run. Is there a way that I can ask Swagger-codegen to output a build with a specific gradle version (>7.2) and gradle.build settings?

1 Answers

In swagger-codegen you can provide custom templates for the generated files. The files are .mustache, you provide a directory of custom mustache files to swagger-codegen with either -t for cli or templateDir if using the gradle plugin.

Below is an extract from the https://github.com/swagger-api/swagger-codegen

You can look at modules/swagger-codegen/src/main/resources/${your-language} for examples. To make your own templates, create your own files and use the -t flag to specify your template folder. It actually is that easy.

Related