Skip to content

Commit 7acba8a

Browse files
jimschubertwing328
authored andcommitted
[generator] Cleanup debugOpenAPI usage/display text (#804)
1 parent 08ca54d commit 7acba8a

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,15 @@ private void configureGeneratorProperties() {
169169
if (!generateApiTests && !generateModelTests) {
170170
config.additionalProperties().put(CodegenConstants.EXCLUDE_TESTS, true);
171171
}
172-
// for backward compatibility
173-
if (System.getProperty("debugSwagger") != null) {
174-
LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'.");
175-
Json.prettyPrint(openAPI);
176-
}
172+
177173

178174
if (System.getProperty("debugOpenAPI") != null) {
179175
Json.prettyPrint(openAPI);
176+
} else if (System.getProperty("debugSwagger") != null) {
177+
// This exists for backward compatibility
178+
// We fall to this block only if debugOpenAPI is null. No need to dump this twice.
179+
LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'.");
180+
Json.prettyPrint(openAPI);
180181
}
181182

182183
config.processOpts();

modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,12 +596,12 @@ private void setVerboseFlags() {
596596
return;
597597
}
598598
LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" +
599-
"\n - [debugSwagger] prints the openapi specification as interpreted by the codegen" +
599+
"\n - [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen" +
600600
"\n - [debugModels] prints models passed to the template engine" +
601601
"\n - [debugOperations] prints operations passed to the template engine" +
602602
"\n - [debugSupportingFiles] prints additional data passed to the template engine");
603603

604-
System.setProperty("debugSwagger", "");
604+
System.setProperty("debugOpenAPI", "");
605605
System.setProperty("debugModels", "");
606606
System.setProperty("debugOperations", "");
607607
System.setProperty("debugSupportingFiles", "");

modules/openapi-generator/src/main/resources/codegen/README.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ the object you have available during client generation:
6262

6363
```
6464
# The following additional debug options are available for all codegen targets:
65-
# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen
65+
# -DdebugOpenAPI prints the OpenAPI Specification as interpreted by the codegen
6666
# -DdebugModels prints models passed to the template engine
6767
# -DdebugOperations prints operations passed to the template engine
6868
# -DdebugSupportingFiles prints additional data passed to the template engine

0 commit comments

Comments
 (0)