Skip to content

Commit e0904f6

Browse files
authored
Merge pull request #9550 from swagger-api/ticket-9540
ref #9540 - fix regression in generate options
2 parents 48f32ce + 965f4ae commit e0904f6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ protected void configureGeneratorProperties() {
135135
} else {
136136
isGenerateModels = System.getProperty(CodegenConstants.MODELS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODELS, null);
137137
}
138-
isGenerateSupportingFiles = System.getProperty(CodegenConstants.SUPPORTING_FILES) != null ? Boolean.valueOf(System.getProperty(CodegenConstants.SUPPORTING_FILES)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null);
138+
String supportingFilesProperty = System.getProperty(CodegenConstants.SUPPORTING_FILES);
139+
if (((supportingFilesProperty != null) && supportingFilesProperty.equalsIgnoreCase("false"))) {
140+
isGenerateSupportingFiles = false;
141+
} else {
142+
isGenerateSupportingFiles = supportingFilesProperty != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null);
143+
}
139144

140145
if (isGenerateApis == null && isGenerateModels == null && isGenerateSupportingFiles == null) {
141146
// no specifics are set, generate everything
@@ -568,7 +573,10 @@ protected void generateSupportingFiles(List<File> files, Map<String, Object> bun
568573
}
569574
Set<String> supportingFilesToGenerate = null;
570575
String supportingFiles = System.getProperty(CodegenConstants.SUPPORTING_FILES);
571-
if (supportingFiles != null && !supportingFiles.isEmpty()) {
576+
boolean generateAll = false;
577+
if (supportingFiles != null && supportingFiles.equalsIgnoreCase("true")) {
578+
generateAll = true;
579+
} else if (supportingFiles != null && !supportingFiles.isEmpty()) {
572580
supportingFilesToGenerate = new HashSet<String>(Arrays.asList(supportingFiles.split(",")));
573581
}
574582

@@ -594,7 +602,7 @@ protected void generateSupportingFiles(List<File> files, Map<String, Object> bun
594602
templateFile = getFullTemplateFile(config, support.templateFile);
595603
}
596604
boolean shouldGenerate = true;
597-
if (supportingFilesToGenerate != null && !supportingFilesToGenerate.isEmpty()) {
605+
if (!generateAll && supportingFilesToGenerate != null && !supportingFilesToGenerate.isEmpty()) {
598606
shouldGenerate = supportingFilesToGenerate.contains(support.destinationFilename);
599607
}
600608
if (!shouldGenerate) {

0 commit comments

Comments
 (0)