forked from loafle/openapi-generator-original
#3284: Made modelNamePrefix and -Suffix available through maven
This commit is contained in:
parent
6d6cfbfd5d
commit
0ada53435c
@ -45,6 +45,7 @@ mvn clean compile
|
|||||||
- `modelPackage` - the package to use for generated model objects/classes
|
- `modelPackage` - the package to use for generated model objects/classes
|
||||||
- `apiPackage` - the package to use for generated api objects/classes
|
- `apiPackage` - the package to use for generated api objects/classes
|
||||||
- `invokerPackage` - the package to use for the generated invoker objects
|
- `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)
|
- `configOptions` - a map of language-specific parameters (see below)
|
||||||
- `configHelp` - dumps the configuration help for the specified library (generates no sources)
|
- `configHelp` - dumps the configuration help for the specified library (generates no sources)
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@ import io.swagger.codegen.ClientOptInput;
|
|||||||
import io.swagger.codegen.CodegenConfig;
|
import io.swagger.codegen.CodegenConfig;
|
||||||
import io.swagger.codegen.DefaultGenerator;
|
import io.swagger.codegen.DefaultGenerator;
|
||||||
import io.swagger.codegen.config.CodegenConfigurator;
|
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.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
@ -32,9 +30,7 @@ import org.apache.maven.project.MavenProject;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static io.swagger.codegen.config.CodegenConfiguratorUtils.*;
|
import static io.swagger.codegen.config.CodegenConfiguratorUtils.*;
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||||
@ -135,6 +131,18 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
@Parameter(name = "library", required = false)
|
@Parameter(name = "library", required = false)
|
||||||
private String library;
|
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
|
* A map of language-specific parameters as passed with the -c option to the command line
|
||||||
*/
|
*/
|
||||||
@ -217,6 +225,14 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
configurator.setLibrary(library);
|
configurator.setLibrary(library);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isNotEmpty(modelNamePrefix)) {
|
||||||
|
configurator.setModelNamePrefix(modelNamePrefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isNotEmpty(modelNameSuffix)) {
|
||||||
|
configurator.setModelNamePrefix(modelNameSuffix);
|
||||||
|
}
|
||||||
|
|
||||||
if (null != templateDirectory) {
|
if (null != templateDirectory) {
|
||||||
configurator.setTemplateDir(templateDirectory.getAbsolutePath());
|
configurator.setTemplateDir(templateDirectory.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user