Merge remote-tracking branch 'origin' into sync_master_230

This commit is contained in:
wing328
2017-02-10 23:31:36 +08:00
1480 changed files with 60531 additions and 12438 deletions

View File

@@ -45,9 +45,11 @@ 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.
- `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums
- `useJaxbAnnotations` - enable Jaxb annotations inside the generated models
- `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
### Custom Generator

View File

@@ -21,6 +21,7 @@ import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyImportMapp
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyInstantiationTypesKvp;
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsv;
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyTypeMappingsKvp;
import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvp;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.io.File;
@@ -161,6 +162,12 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(name = "modelNameSuffix", required = false)
private String modelNameSuffix;
/**
* Sets an optional ignoreFileOverride path
*/
@Parameter(name = "ignoreFileOverride", required = false)
private String ignoreFileOverride;
/**
* A map of language-specific parameters as passed with the -c option to the command line
*/
@@ -215,6 +222,10 @@ public class CodeGenMojo extends AbstractMojo {
configurator.setGitRepoId(gitRepoId);
}
if(isNotEmpty(ignoreFileOverride)) {
configurator.setIgnoreFileOverride(ignoreFileOverride);
}
configurator.setLang(language);
configurator.setOutputDir(output.getAbsolutePath());
@@ -284,6 +295,10 @@ public class CodeGenMojo extends AbstractMojo {
if(configOptions.containsKey("additional-properties")) {
applyAdditionalPropertiesKvp(configOptions.get("additional-properties").toString(), configurator);
}
if(configOptions.containsKey("reserved-words-mappings")) {
applyReservedWordsMappingsKvp(configOptions.get("reserved-words-mappings").toString(), configurator);
}
}
if (environmentVariables != null) {
@@ -330,7 +345,7 @@ public class CodeGenMojo extends AbstractMojo {
}
if (addCompileSourceRoot) {
final Object sourceFolderObject = configOptions.get(CodegenConstants.SOURCE_FOLDER);
final Object sourceFolderObject = configOptions == null ? null : configOptions.get(CodegenConstants.SOURCE_FOLDER);
final String sourceFolder = sourceFolderObject == null ? "src/main/java" : sourceFolderObject.toString();
String sourceJavaFolder = output.toString() + "/" + sourceFolder;