swagger-api / swagger-api/swagger-codegen

[kotlin] Error building kotlin-server with petstore yaml

Open
#7,591 3 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

Error generating the kotin-sever code when using the petstore sample yaml file.

Output:

java -jar ./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i ./modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l kotlin-server -o ./petstoreOut

...
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/somedude/projects/swagger/swagger-codegen/./petstoreOut/src/main/kotlin/io/swagger/server/models/User.kt
[main] ERROR io.swagger.codegen.AbstractGenerator - kotlin-server/api.mustache (No such file or directory)
[main] ERROR io.swagger.codegen.AbstractGenerator - can't load template kotlin-server/api.mustache
Exception in thread "main" java.lang.RuntimeException: Could not generate api file for 'Pet'
	at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:542)
	at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:749)
	at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
	at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: java.lang.RuntimeException: can't load template kotlin-server/api.mustache
	at io.swagger.codegen.AbstractGenerator.readTemplate(AbstractGenerator.java:51)
	at io.swagger.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:763)
	at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:501)
	... 3 more
Swagger-codegen version

master as of Feb 05, 2018

Swagger declaration file content or url
./modules/swagger-codegen/src/test/resources/2_0/petstore.yaml
Command line used for generation
java -jar ./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i ./modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l kotlin-server -o ./petstoreOut
Steps to reproduce

Run the command above against the petstore yaml

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 with the kotlin-server generation path and the missing kotlin-server/api.mustache template reported by the command. Run the petstore.yaml generation command from the issue, inspect the relevant templates and generator entry points, and consider the issue done when it generates the Pet API without the missing-template error.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
backend, 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.