[BUG] Option template directory ignored in 4.1.0-SNAPSHOT
Created by: MichalFoksa
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
Looks like template directory option (-t | --template-dir ) is ignored in 4.1.0-SNAPSHOT. Template directory always defaults to embeded dir.
Following condition from DefaultCodegen.processOpts() evaluates to false even when -t
option is provided, e.g: -t swagger/my-template
.
if (additionalProperties.containsKey(CodegenConstants.TEMPLATE_DIR))
I have added a log message right at the end of DefaultCodegen.processOpts() method:
LOGGER.info("Template directory [templateDir={}]", this.templateDir());
Result message:
[main] INFO o.o.codegen.DefaultCodegen - [Template directory [templateDir=openapi-yaml]
BTW: Same issue is with Spring generator.
openapi-generator version
4.1.0-SNAPSHOT as of 14/July/2019.
Steps to reproduce
java -jar "./modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate -i swagger/openapi.yml -g openapi-yaml -t swagger/my-template --additional-properties outputFile=swagger/swagger.yml
Suggest a fix
It looks like there is a quite difference in code gen configuration (e.g.: CodegenConfigurator.java) between 4.0.x and 4.1.0.
I do not know what is a direction in 4.1.x.