[openapi-yaml] Config option outputFile was ignored by the generator. (#3199)

This commit is contained in:
Michal Foksa
2019-06-24 16:58:38 +02:00
committed by Jérémie Bresson
parent 06cfdbbdc6
commit 4ac33d80f0
4 changed files with 174 additions and 59 deletions

View File

@@ -28,7 +28,7 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi
private static final Logger LOGGER = LoggerFactory.getLogger(OpenAPIYamlGenerator.class);
protected String outputFile = "openapi.yaml";
protected String outputFile = "openapi/openapi.yaml";
public OpenAPIYamlGenerator() {
super();
@@ -36,9 +36,6 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi
outputFolder = "generated-code/openapi-yaml";
cliOptions.add(new CliOption(OUTPUT_NAME, "output filename"));
supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
supportingFiles.add(new SupportingFile("openapi.mustache",
"openapi",
"openapi.yaml"));
}
@Override
@@ -56,13 +53,14 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi
return "Creates a static openapi.yaml file (OpenAPI spec v3).";
}
@Override
public void processOpts() {
super.processOpts();
if (additionalProperties.containsKey(OUTPUT_NAME)) {
this.outputFile = additionalProperties.get(OUTPUT_NAME).toString();
outputFile = additionalProperties.get(OUTPUT_NAME).toString();
}
LOGGER.info("Output file [outputFile={}]", outputFile);
supportingFiles.add(new SupportingFile("openapi.mustache", outputFile));
}
@Override
@@ -71,7 +69,6 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi
return super.postProcessSupportingFileData(objs);
}
@Override
public String escapeQuotationMark(String input) {
// just return the original string