From 7acba8a4d86b3cdadc5707345817513dad11c36f Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Mon, 13 Aug 2018 23:45:50 -0400 Subject: [PATCH] [generator] Cleanup debugOpenAPI usage/display text (#804) --- .../org/openapitools/codegen/DefaultGenerator.java | 11 ++++++----- .../codegen/config/CodegenConfigurator.java | 4 ++-- .../src/main/resources/codegen/README.mustache | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 6d4264f48c1e..1ba9611cfd36 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -169,14 +169,15 @@ private void configureGeneratorProperties() { if (!generateApiTests && !generateModelTests) { config.additionalProperties().put(CodegenConstants.EXCLUDE_TESTS, true); } - // for backward compatibility - if (System.getProperty("debugSwagger") != null) { - LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'."); - Json.prettyPrint(openAPI); - } + if (System.getProperty("debugOpenAPI") != null) { Json.prettyPrint(openAPI); + } else if (System.getProperty("debugSwagger") != null) { + // This exists for backward compatibility + // We fall to this block only if debugOpenAPI is null. No need to dump this twice. + LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'."); + Json.prettyPrint(openAPI); } config.processOpts(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index e787821cdd9c..8ec858f2bfb6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -596,12 +596,12 @@ private void setVerboseFlags() { return; } LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" + - "\n - [debugSwagger] prints the openapi specification as interpreted by the codegen" + + "\n - [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen" + "\n - [debugModels] prints models passed to the template engine" + "\n - [debugOperations] prints operations passed to the template engine" + "\n - [debugSupportingFiles] prints additional data passed to the template engine"); - System.setProperty("debugSwagger", ""); + System.setProperty("debugOpenAPI", ""); System.setProperty("debugModels", ""); System.setProperty("debugOperations", ""); System.setProperty("debugSupportingFiles", ""); diff --git a/modules/openapi-generator/src/main/resources/codegen/README.mustache b/modules/openapi-generator/src/main/resources/codegen/README.mustache index 2b575c6b1360..d8c6ab3ca32a 100644 --- a/modules/openapi-generator/src/main/resources/codegen/README.mustache +++ b/modules/openapi-generator/src/main/resources/codegen/README.mustache @@ -62,7 +62,7 @@ the object you have available during client generation: ``` # The following additional debug options are available for all codegen targets: -# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen +# -DdebugOpenAPI prints the OpenAPI Specification as interpreted by the codegen # -DdebugModels prints models passed to the template engine # -DdebugOperations prints operations passed to the template engine # -DdebugSupportingFiles prints additional data passed to the template engine