swagger-api / swagger-api/swagger-codegen-generators

[Swift5] Can't use templates

Open
#707 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Description

There is the error FileNotFoundException when I use -t parameter for language Swift5

command line log:

at io.swagger.codegen.v3.DefaultGenerator.generateModels(DefaultGenerator.java:451)
at io.swagger.codegen.v3.DefaultGenerator.generate(DefaultGenerator.java:779)
at io.swagger.codegen.v3.cli.cmd.Generate.run(Generate.java:369)
at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.io.FileNotFoundException: handlebars/swift5/model.mustache
at com.github.jknack.handlebars.io.URLTemplateLoader.sourceAt(URLTemplateLoader.java:70)
at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:438)
at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:419)
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.processTemplateToFile(DefaultGenerator.java:795)
at io.swagger.codegen.v3.DefaultGenerator.generateModels(DefaultGenerator.java:438)
... 3 more
Swagger-codegen version

3.0.20

Swagger declaration file content or url
Command line used for generation

swagger-codegen generate -i PATH_TO_JSON -l swift5 -t PATH_TO_TEMPLATES -o OUTPUT_PATH

Steps to reproduce

Run the command above

Related issues/PRs

https://github.com/swagger-api/swagger-codegen/issues/10107

Suggest a fix/enhancement

https://github.com/swagger-api/swagger-codegen-generators/commit/1149e58bc6a54b54f3ac232a6f4e7e5ed5912f0b
Make similar changes to the swift5 codegen file

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided swagger-codegen generate command with the Swift5 language and inspect the missing handlebars/swift5/model.mustache path. Compare the Swift5 codegen templates with the changes in the referenced commit and review related issue #10107. Done means Swift5 model generation completes without the FileNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.