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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With