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
1 change: 1 addition & 0 deletions modules/swagger-codegen-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ mvn clean compile
- `modelPackage` - the package to use for generated model objects/classes
- `apiPackage` - the package to use for generated api objects/classes
- `invokerPackage` - the package to use for the generated invoker objects
- `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums.
- `configOptions` - a map of language-specific parameters (see below)
- `configHelp` - dumps the configuration help for the specified library (generates no sources)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.DefaultGenerator;
import io.swagger.codegen.config.CodegenConfigurator;
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
Expand All @@ -32,9 +30,7 @@

import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import static io.swagger.codegen.config.CodegenConfiguratorUtils.*;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
Expand Down Expand Up @@ -135,6 +131,18 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(name = "library", required = false)
private String library;

/**
* Sets the prefix for model enums and classes
*/
@Parameter(name = "modelNamePrefix", required = false)
private String modelNamePrefix;

/**
* Sets the suffix for model enums and classes
*/
@Parameter(name = "modelNameSuffix", required = false)
private String modelNameSuffix;

/**
* A map of language-specific parameters as passed with the -c option to the command line
*/
Expand Down Expand Up @@ -217,6 +225,14 @@ public void execute() throws MojoExecutionException {
configurator.setLibrary(library);
}

if(isNotEmpty(modelNamePrefix)) {
configurator.setModelNamePrefix(modelNamePrefix);
}

if(isNotEmpty(modelNameSuffix)) {
configurator.setModelNameSuffix(modelNameSuffix);
}

if (null != templateDirectory) {
configurator.setTemplateDir(templateDirectory.getAbsolutePath());
}
Expand Down