diff --git a/modules/swagger-codegen-maven-plugin/README.md b/modules/swagger-codegen-maven-plugin/README.md index 64382be8678..0b71c64b68f 100644 --- a/modules/swagger-codegen-maven-plugin/README.md +++ b/modules/swagger-codegen-maven-plugin/README.md @@ -50,6 +50,15 @@ mvn clean compile - `configOptions` - a map of language-specific parameters (see below) - `configHelp` - dumps the configuration help for the specified library (generates no sources) - `ignoreFileOverride` - specifies the full path to a `.swagger-codegen-ignore` used for pattern based overrides of generated outputs +- `generateApis` - generate the apis (`true` by default) +- `generateApiTests` - generate the api tests (`true` by default. Only available if `generateApis` is `true`) +- `generateApiDocumentation` - generate the api documentation (`true` by default. Only available if `generateApis` is `true`) +- `generateModels` - generate the models (`true` by default) +- `modelsToGenerate` - A comma separated list of models to generate. All models is the default. +- `generateModelTests` - generate the model tests (`true` by default. Only available if `generateModels` is `true`) +- `generateModelDocumentation` - generate the model documentation (`true` by default. Only available if `generateModels` is `true`) +- `generateSupportingFiles` - generate the supporting files (`true` by default) +- `supportingFilesToGenerate` - A comma separated list of supporting files to generate. All files is the default. ### Custom Generator diff --git a/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java b/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java index 613c2b9186f..15d3b4a86da 100644 --- a/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java +++ b/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java @@ -174,6 +174,62 @@ public class CodeGenMojo extends AbstractMojo { @Parameter(name = "configOptions") private Map configOptions; + /** + * Generate the apis + */ + @Parameter(name = "generateApis", required = false) + private Boolean generateApis = true; + + /** + * Generate the models + */ + @Parameter(name = "generateModels", required = false) + private Boolean generateModels = true; + + /** + * A comma separated list of models to generate. All models is the default. + */ + @Parameter(name = "modelsToGenerate", required = false) + private String modelsToGenerate = ""; + + /** + * Generate the supporting files + */ + @Parameter(name = "generateSupportingFiles", required = false) + private Boolean generateSupportingFiles = true; + + /** + * A comma separated list of models to generate. All models is the default. + */ + @Parameter(name = "supportingFilesToGenerate", required = false) + private String supportingFilesToGenerate = ""; + + /** + * Generate the model tests + */ + @Parameter(name = "generateModelTests", required = false) + private Boolean generateModelTests = true; + + /** + * Generate the model documentation + */ + @Parameter(name = "generateModelDocumentation", required = false) + private Boolean generateModelDocumentation = true; + + /** + * Generate the api tests + */ + @Parameter(name = "generateApiTests", required = false) + private Boolean generateApiTests = true; + + /** + * Generate the api documentation + */ + @Parameter(name = "generateApiDocumentation", required = false) + private Boolean generateApiDocumentation = true; + + + /** * Add the output directory to the project as a source root, so that the * generated java types are compiled and included in the project artifact. @@ -274,6 +330,23 @@ public void execute() throws MojoExecutionException { configurator.setTemplateDir(templateDirectory.getAbsolutePath()); } + // Set generation options + if (null != generateApis && generateApis) { + System.setProperty("apis", ""); + } + if (null != generateModels && generateModels) { + System.setProperty("models", modelsToGenerate); + } + + if (null != generateSupportingFiles && generateSupportingFiles) { + System.setProperty("supportingFiles", supportingFilesToGenerate); + } + + System.setProperty("modelTests", generateModelTests.toString()); + System.setProperty("modelDocs", generateModelDocumentation.toString()); + System.setProperty("apiTests", generateApiTests.toString()); + System.setProperty("apiDocs", generateApiDocumentation.toString()); + if (configOptions != null) { if(configOptions.containsKey("instantiation-types")) {