swagger-api / swagger-api/swagger-codegen

version 3.0.0-rc1 not working with angular

Open
#8,471 2 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

Description

upgrading to v3 makes generation failed.

Swagger-codegen version

3.0.0-rc1

Swagger declaration file content or url
Command line used for generation
java -jar .\swagger-codegen-cli-3.0.0-rc1.jar generate `
 -l typescript-angular `
  -i .\xxx-Service-2.0.0-swagger.yaml `
   -o xxx `
     --additional-properties modelPropertyNaming=original
Output
[Thread-1] INFO io.swagger.codegen.languages.typescript.TypeScriptAngularClientCodegen -   (you can select t
he angular version by setting the additionalProperty ngVersion)
Exception in thread "Thread-1" java.lang.RuntimeException: Could not generate model 'CreateLocalProfileModel
'
        at io.swagger.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:409)
        at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:728)
        at io.swagger.codegen.cmd.Generate.run(Generate.java:331)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: /v2\typescript-angular/v2/typescript-angular/model.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.DefaultGenerator.getHandlebars(DefaultGenerator.java:1026)
        at io.swagger.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:744)
        at io.swagger.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:396)
        ... 3 more

Related issues/PRs
Suggest a fix/enhancement

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 command with swagger-codegen-cli-3.0.0-rc1 and inspect TypeScriptAngularClientCodegen alongside DefaultGenerator.java, especially the model generation path. Check why the model.mustache template is resolved as /v2/typescript-angular/v2/typescript-angular/model.mustache; done means the same Angular generation completes without the FileNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, java, typescript
Domain
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.