Skip to content

Commit

Permalink
Merge pull request #9550 from swagger-api/ticket-9540
Browse files Browse the repository at this point in the history
ref #9540 - fix regression in generate options
  • Loading branch information
frantuma authored Jul 8, 2019
2 parents 48f32ce + 965f4ae commit e0904f6
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ protected void configureGeneratorProperties() {
} else {
isGenerateModels = System.getProperty(CodegenConstants.MODELS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODELS, null);
}
isGenerateSupportingFiles = System.getProperty(CodegenConstants.SUPPORTING_FILES) != null ? Boolean.valueOf(System.getProperty(CodegenConstants.SUPPORTING_FILES)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null);
String supportingFilesProperty = System.getProperty(CodegenConstants.SUPPORTING_FILES);
if (((supportingFilesProperty != null) && supportingFilesProperty.equalsIgnoreCase("false"))) {
isGenerateSupportingFiles = false;
} else {
isGenerateSupportingFiles = supportingFilesProperty != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null);
}

if (isGenerateApis == null && isGenerateModels == null && isGenerateSupportingFiles == null) {
// no specifics are set, generate everything
Expand Down Expand Up @@ -568,7 +573,10 @@ protected void generateSupportingFiles(List<File> files, Map<String, Object> bun
}
Set<String> supportingFilesToGenerate = null;
String supportingFiles = System.getProperty(CodegenConstants.SUPPORTING_FILES);
if (supportingFiles != null && !supportingFiles.isEmpty()) {
boolean generateAll = false;
if (supportingFiles != null && supportingFiles.equalsIgnoreCase("true")) {
generateAll = true;
} else if (supportingFiles != null && !supportingFiles.isEmpty()) {
supportingFilesToGenerate = new HashSet<String>(Arrays.asList(supportingFiles.split(",")));
}

Expand All @@ -594,7 +602,7 @@ protected void generateSupportingFiles(List<File> files, Map<String, Object> bun
templateFile = getFullTemplateFile(config, support.templateFile);
}
boolean shouldGenerate = true;
if (supportingFilesToGenerate != null && !supportingFilesToGenerate.isEmpty()) {
if (!generateAll && supportingFilesToGenerate != null && !supportingFilesToGenerate.isEmpty()) {
shouldGenerate = supportingFilesToGenerate.contains(support.destinationFilename);
}
if (!shouldGenerate) {
Expand Down

0 comments on commit e0904f6

Please sign in to comment.