swagger-api / swagger-api/swagger-codegen

[Java]RuntimeException when "headers" response section is defined

Open
#8,139 1 comment 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

Hi,

I'm facing to an issue with codegen 2.3.1 when headers response section is defined. Remove it works.

    ....
   "responses":{  
      "200":{  
         "description":"OK",
         "headers":{  
            "X-app-params":{  
               "type":"integer",
               "description":"...................."
            }
         }
      }
   }
   ...

Command line output result :

java -jar swagger-codegen-cli-2.3.1.jar generate -i api-docs.json -l java -o project -c config.json
[main] INFO io.swagger.parser.Swagger20Parser - reading from api-docs.json
[main] INFO io.swagger.parser.Swagger20Parser - reading from api-docs.json
[main] WARN io.swagger.codegen.ignore.CodegenIgnoreProcessor - Output directory does not exist, or is inaccessible. No file (.swagger-codegen-ignore) will be evaluated.
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
        at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:731)
        at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
        at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)

Regards

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 failure with the supplied OpenAPI response headers, swagger-codegen-cli-2.3.1, and the shown generate command. Start at DefaultGenerator.java:731 and the Generate.run entry point, then verify that generation no longer raises the missing-input or config RuntimeException when headers are defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, cli, 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.