|
21 | 21 | import io.swagger.codegen.CodegenConfig;
|
22 | 22 | import io.swagger.codegen.DefaultGenerator;
|
23 | 23 | import io.swagger.codegen.config.CodegenConfigurator;
|
24 |
| -import io.swagger.models.Swagger; |
25 |
| -import io.swagger.parser.SwaggerParser; |
26 | 24 | import org.apache.maven.plugin.AbstractMojo;
|
27 | 25 | import org.apache.maven.plugin.MojoExecutionException;
|
28 | 26 | import org.apache.maven.plugins.annotations.LifecyclePhase;
|
|
32 | 30 |
|
33 | 31 | import java.io.File;
|
34 | 32 | import java.util.HashMap;
|
35 |
| -import java.util.HashSet; |
36 | 33 | import java.util.Map;
|
37 |
| -import java.util.Set; |
38 | 34 |
|
39 | 35 | import static io.swagger.codegen.config.CodegenConfiguratorUtils.*;
|
40 | 36 | import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
@@ -135,6 +131,18 @@ public class CodeGenMojo extends AbstractMojo {
|
135 | 131 | @Parameter(name = "library", required = false)
|
136 | 132 | private String library;
|
137 | 133 |
|
| 134 | + /** |
| 135 | + * Sets the prefix for model enums and classes |
| 136 | + */ |
| 137 | + @Parameter(name = "modelNamePrefix", required = false) |
| 138 | + private String modelNamePrefix; |
| 139 | + |
| 140 | + /** |
| 141 | + * Sets the suffix for model enums and classes |
| 142 | + */ |
| 143 | + @Parameter(name = "modelNameSuffix", required = false) |
| 144 | + private String modelNameSuffix; |
| 145 | + |
138 | 146 | /**
|
139 | 147 | * A map of language-specific parameters as passed with the -c option to the command line
|
140 | 148 | */
|
@@ -217,6 +225,14 @@ public void execute() throws MojoExecutionException {
|
217 | 225 | configurator.setLibrary(library);
|
218 | 226 | }
|
219 | 227 |
|
| 228 | + if(isNotEmpty(modelNamePrefix)) { |
| 229 | + configurator.setModelNamePrefix(modelNamePrefix); |
| 230 | + } |
| 231 | + |
| 232 | + if(isNotEmpty(modelNameSuffix)) { |
| 233 | + configurator.setModelNameSuffix(modelNameSuffix); |
| 234 | + } |
| 235 | + |
220 | 236 | if (null != templateDirectory) {
|
221 | 237 | configurator.setTemplateDir(templateDirectory.getAbsolutePath());
|
222 | 238 | }
|
|
0 commit comments