如何修复 java.lang.RuntimeException:缺少招摇输入或配置? [英] How to fix java.lang.RuntimeException: missing swagger input or config?

查看:10
本文介绍了如何修复 java.lang.RuntimeException:缺少招摇输入或配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm trying to generate java code from swagger.json using swagger-codegen-cli.jar but I get this exception:

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

The command I'm trying to run is the following:

java -jar swagger-codegen-cli.jar generate -i swagger.json -l java -c java-config.json -o api-client

解决方案

You are using Swagger Codegen 2.x which does not support OpenAPI 3.0.

You need to use Swagger Codegen 3.x instead. You can download the latest 3.x CLI JAR from Maven Central:
https://mvnrepository.com/artifact/io.swagger.codegen.v3/swagger-codegen-cli

Here's a direct link to v. 3.0.20 CLI (the latest version as of the time of writing):
https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.20/swagger-codegen-cli-3.0.20.jar


Or if you prefer to build the codegen from the source code, version 3 is in the 3.0.0 branch:
https://github.com/swagger-api/swagger-codegen/tree/3.0.0

这篇关于如何修复 java.lang.RuntimeException:缺少招摇输入或配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆