swagger-api / swagger-api/swagger-codegen

It doesn't generate anything and prints some strange messages

Open
#11,662 0 comments 1 reaction 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

I run codegen like this:

$ docker run -it swaggerapi/swagger-codegen-cli generate -i aaa.json -l html

And it prints some odd things:

[main] INFO io.swagger.parser.Swagger20Parser - reading from aaa.json
[main] INFO io.swagger.parser.Swagger20Parser - reading from aaa.json
[main] ERROR io.swagger.parser.SwaggerCompatConverter - failed to read resource listing
java.lang.RuntimeException: Could not find aaa.json on the classpath
        at io.swagger.parser.util.ClasspathHelper.loadFileFromClasspath(ClasspathHelper.java:31)
        at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:206)
        at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:122)
        at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:96)
        at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:450)
        at io.swagger.codegen.cmd.Generate.run(Generate.java:305)
        at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
[main] INFO io.swagger.codegen.ignore.CodegenIgnoreProcessor - No .swagger-codegen-ignore file found.
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
        at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:766)
        at io.swagger.codegen.cmd.Generate.run(Generate.java:307)
        at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)

And this one is especially confusing:

java.lang.RuntimeException: Could not find aaa.json on the classpath

It's just a file in the current directory, why would it want to be on the classpath?

P.S. Is my understand correct that -l html is gonna build this page?

image

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 docker command with the supplied aaa.json input, then trace input handling from Generate.run through CodegenConfigurator.toClientOptInput, SwaggerParser.read, and DefaultGenerator.generate. Check the existing CLI tests or documentation for local-file inputs and the html generator; done means the command's expected behavior and error message are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.