swagger-api / swagger-api/swagger-codegen

Cannot generate api for playWS

Open
#11,933 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Codegen cli shows an error for generating a playWS client for a given api

Command ran

java -jar ./swagger-codegen-cli-3.0.35.jar generate -i https://petstore3.swagger.io/api/v3/openapi.json -l java -c .\config.json

Config is

{
    "usePlayWS" : true
}

The error produced is

Exception in thread "Thread-0" java.lang.RuntimeException: Could not generate api file for 'Pet'
        at io.swagger.codegen.v3.DefaultGenerator.generateApis(DefaultGenerator.java:588)
        at io.swagger.codegen.v3.DefaultGenerator.generate(DefaultGenerator.java:791)
        at io.swagger.codegen.v3.cli.cmd.Generate.run(Generate.java:388)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.FileNotFoundException: /handlebars/Java/handlebars/Java/play25/api.mustache
        at com.github.jknack.handlebars.io.URLTemplateLoader.sourceAt(URLTemplateLoader.java:70)
        at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:500)
        at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:481)
        at io.swagger.codegen.v3.templates.HandlebarTemplateEngine.getHandlebars(HandlebarTemplateEngine.java:41)
        at io.swagger.codegen.v3.templates.HandlebarTemplateEngine.getRendered(HandlebarTemplateEngine.java:21)
        at io.swagger.codegen.v3.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:804)
        at io.swagger.codegen.v3.DefaultGenerator.generateApis(DefaultGenerator.java:547)

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

Reproduce the issue with the provided swagger-codegen-cli command and config.json, then trace template resolution through DefaultGenerator.generateApis and HandlebarTemplateEngine.getHandlebars. Check the reported /handlebars/Java/handlebars/Java/play25/api.mustache lookup; done means the same playWS generation completes for the supplied Petstore OpenAPI document without FileNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
handlebars, java
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.