Closed
Description
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
Custom templates provided via -t/--template-dir are not being applied for aspnetcore generator in 4.3.1. Works fine in 4.3.0
openapi-generator version
4.3.1
OpenAPI declaration file content or url
Command line used for generation
openapi-generator-cli generate -g aspnetcore -i input.yaml -o out-dir -t templates
Steps to reproduce
Modify any mustache template for aspnetcore, run generate with -t pointing to directory with modified template.
Files are generated according to embedded template, any modifications are lost.
Related issues/PRs
Could not find any
Suggest a fix
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java
index fcd882f6d9..403392e03c 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java
@@ -547,7 +547,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
compatibilityVersion = "Version_" + aspnetCoreVersion.getOptValue().replace(".", "_");
}
LOGGER.info("ASP.NET core version: " + aspnetCoreVersion.getOptValue());
- embeddedTemplateDir = templateDir = "aspnetcore/" + determineTemplateVersion(aspnetCoreVersion.getOptValue());
+ embeddedTemplateDir = "aspnetcore/" + determineTemplateVersion(aspnetCoreVersion.getOptValue());
additionalProperties.put(COMPATIBILITY_VERSION, compatibilityVersion);
}