简体   繁体   中英

Swagger codegen failed: missing swagger input or config

I have this json file and I have been trying to create models and API code through swagger codegen. This has not been quiet effective as it throws error.

Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
    at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:735)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)

The swagger docs version is 1.2. And I am using swagger-codegen version 2.4.0.

java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i ./json/docs.json -l python -o C:/Users/sk/projects/generated-sdk

In the yaml file, if you do not strictly have the indent, you can get the error like this. For swagger-codegen-cli-2.1.6.jar, the error message won't tell you which row is wrong. (Just not sure whether this get fixed in the newer version. )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM