forked from loafle/openapi-generator-original
Merge pull request #2082 from jhitchcock/feature/vendorExtensionsRoot
Add VendorExtensions to root swagger
This commit is contained in:
commit
f79ec39d8d
@ -19,6 +19,8 @@ public interface CodegenConfig {
|
||||
|
||||
Map<String, Object> additionalProperties();
|
||||
|
||||
Map<String, Object> vendorExtensions();
|
||||
|
||||
String testPackage();
|
||||
|
||||
String apiPackage();
|
||||
|
@ -71,6 +71,7 @@ public class DefaultCodegen {
|
||||
protected String templateDir;
|
||||
protected String embeddedTemplateDir;
|
||||
protected Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
protected Map<String, Object> vendorExtensions = new HashMap<String, Object>();
|
||||
protected List<SupportingFile> supportingFiles = new ArrayList<SupportingFile>();
|
||||
protected List<CliOption> cliOptions = new ArrayList<CliOption>();
|
||||
protected boolean skipOverwrite;
|
||||
@ -247,6 +248,10 @@ public class DefaultCodegen {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
public Map<String, Object> vendorExtensions() {
|
||||
return vendorExtensions;
|
||||
}
|
||||
|
||||
public List<SupportingFile> supportingFiles() {
|
||||
return supportingFiles;
|
||||
}
|
||||
|
@ -134,6 +134,10 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
}
|
||||
|
||||
if(swagger.getVendorExtensions() != null) {
|
||||
config.vendorExtensions().putAll(swagger.getVendorExtensions());
|
||||
}
|
||||
|
||||
StringBuilder hostBuilder = new StringBuilder();
|
||||
String scheme;
|
||||
if (swagger.getSchemes() != null && swagger.getSchemes().size() > 0) {
|
||||
@ -274,6 +278,10 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
operation.put("classVarName", config.toApiVarName(tag));
|
||||
operation.put("importPath", config.toApiImport(tag));
|
||||
|
||||
if(!config.vendorExtensions().isEmpty()) {
|
||||
operation.put("vendorExtensions", config.vendorExtensions());
|
||||
}
|
||||
|
||||
// Pass sortParamsByRequiredFlag through to the Mustache template...
|
||||
boolean sortParamsByRequiredFlag = true;
|
||||
if (this.config.additionalProperties().containsKey(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user