Open demonfiddler opened 6 years ago
hello @demonfiddler , can you please try with 3.0.0-SNAPSHOT?
Hello @HugoMario, thank you for the response. Whence may one obtain io.swagger:swagger-codegen-maven-plugin:3.0.0-SNAPSHOT? It's not on Maven Central. Or is there some other central snapshot repo of which I'm unaware? Or do I have to build it myself?
Description
Custom templates for supporting files don't get resolved under Windows. The reason is that DefaultGenerator.generateSupportingFiles (around line 581 in version 3.0.0-rc1) contains the following erroneous construct:
On Windows, config.templateDir() returns the canonical Windows path of the custom template directory (e.g. C:\source\svn\WBPM\cloud\obj-api\trunk\objectapi\templates\jaxrs-cxf) whereas templateName has already been converted (at around line 568, which changes \ to / in templateFile) to use Unix-style path separator and has a value like C:/source/svn/WBPM/cloud/obj-api/trunk/objectapi/templates/jaxrs-cxf/server/pom.mustache. Thus the call to getHandlebars() fails with the following exception:
java.io.FileNotFoundException: C:\source\svn\WBPM\cloud\obj-api\trunk\objectapi\templates\jaxrs-cxf/C:/source/svn/WBPM/cloud/obj-api/trunk/objectapi/templates/jaxrs-cxf/server/pom.mustache
I discovered this while trying to use swagger-codegen-maven-plugin to generate jaxrs-cxf code with custom templates (BTW the existing jaxrs-cxf templates do not yield an executable Spring application).
Isn't it rather a major bug that custom templates don't work on Windows?!
Swagger-codegen version
3.0.0-rc1
Swagger declaration file content or url
Sorry, I am not permitted to post the YAML in question, for reasons of commercial confidentiality. Pretty much any old YAML should suffice.
Command line used for generation
swagger-codegen-maven-plugin configuration:
Steps to reproduce
Run mvn install on a project configured to invoke swagger-codegen-maven-plugin configured as above.
Related issues/PRs
I had to patch in a fix for the following bug to get this far: https://github.com/swagger-api/swagger-codegen/issues/8291
Suggest a fix/enhancement
Please see the description. I don't have a suggested fix at this point.