Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/swagger-codegen-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")) {
Expand Down