Skip to content

Commit dedb5ce

Browse files
authored
Merge pull request #9452 from swagger-api/fix-generate-options
fix generate options
2 parents 05db33c + 83a3de0 commit dedb5ce

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
@@ -125,9 +125,17 @@ private String getHost() {
125125
protected void configureGeneratorProperties() {
126126
// allows generating only models by specifying a CSV of models to generate, or empty for all
127127
// NOTE: Boolean.TRUE is required below rather than `true` because of JVM boxing constraints and type inference.
128-
isGenerateApis = System.getProperty(CodegenConstants.APIS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.APIS, null);
129-
isGenerateModels = System.getProperty(CodegenConstants.MODELS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODELS, null);
130-
isGenerateSupportingFiles = System.getProperty(CodegenConstants.SUPPORTING_FILES) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null);
128+
if (System.getProperty(CodegenConstants.GENERATE_APIS) != null) {
129+
isGenerateApis = Boolean.valueOf(System.getProperty(CodegenConstants.GENERATE_APIS));
130+
} else {
131+
isGenerateApis = System.getProperty(CodegenConstants.APIS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.APIS, null);
132+
}
133+
if (System.getProperty(CodegenConstants.GENERATE_MODELS) != null) {
134+
isGenerateModels = Boolean.valueOf(System.getProperty(CodegenConstants.GENERATE_MODELS));
135+
} else {
136+
isGenerateModels = System.getProperty(CodegenConstants.MODELS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODELS, null);
137+
}
138+
isGenerateSupportingFiles = System.getProperty(CodegenConstants.SUPPORTING_FILES) != null ? Boolean.valueOf(System.getProperty(CodegenConstants.SUPPORTING_FILES)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null);
131139

132140
if (isGenerateApis == null && isGenerateModels == null && isGenerateSupportingFiles == null) {
133141
// no specifics are set, generate everything

0 commit comments

Comments
 (0)