Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[html2] template-dir option is not working #9521

Closed
lagebaue opened this issue Jun 25, 2019 · 2 comments
Closed

[html2] template-dir option is not working #9521

lagebaue opened this issue Jun 25, 2019 · 2 comments

Comments

@lagebaue
Copy link

Description

The generator works fine without the template-dir option, but if it is set it crashes with the following error (doesn't even matter if there are any files in the folder or not, as long as the folder exists).

Exception in thread "Thread-1" java.lang.RuntimeException: Could not generate supporting file 'SupportingFile:
        templateFile: index.mustache
        folder:
        destinationFilename: index.html
'
        at io.swagger.codegen.v3.DefaultGenerator.generateSupportingFiles(DefaultGenerator.java:636)
        at io.swagger.codegen.v3.DefaultGenerator.generate(DefaultGenerator.java:763)
        at io.swagger.codegen.v3.cli.cmd.Generate.run(Generate.java:342)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: handlebars/htmlDocs2/index.mustache
        at com.github.jknack.handlebars.io.URLTemplateLoader.sourceAt(URLTemplateLoader.java:70)
        at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:357)
        at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:343)
        at io.swagger.codegen.v3.templates.HandlebarTemplateEngine.getHandlebars(HandlebarTemplateEngine.java:48)
        at io.swagger.codegen.v3.templates.HandlebarTemplateEngine.getRendered(HandlebarTemplateEngine.java:24)
        at io.swagger.codegen.v3.DefaultGenerator.generateSupportingFiles(DefaultGenerator.java:607)
        ... 3 more
Swagger-codegen version

3.0.8

Command line used for generation
$ java -jar ./dist/swagger-codegen-cli-3.0.8.jar generate -i docs/openapi.yaml -l html2 -o dist/html2 --template-dir docs/htmlDocs2
Steps to reproduce
  1. execute the above command while template-dir is pointing to an existing directory
Related issues/PRs

This seems to be identical to this problem for the html generator.

@anselmos
Copy link

As mentioned in #9363 - try with adding this parameter: `--template-engine "mustache"
@lagebaue

@HugoMario
Copy link
Contributor

@lagebaue , i merge this PR to solve this issue, i'm going to close it, but please let me know if if you still get the error to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants