简体   繁体   English

Swagger 代码生成失败:缺少 swagger 输入或配置

[英]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.我有这个 json 文件,我一直在尝试通过 swagger codegen 创建模型和 API 代码。 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. swagger 文档版本是 1.2。 And I am using swagger-codegen version 2.4.0.我正在使用 swagger-codegen 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.在yaml文件中,如果你没有严格的缩进,你会得到这样的错误。 For swagger-codegen-cli-2.1.6.jar, the error message won't tell you which row is wrong.对于 swagger-codegen-cli-2.1.6.jar,错误消息不会告诉您哪一行是错误的。 (Just not sure whether this get fixed in the newer version. ) (只是不确定这是否在较新版本中得到修复。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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