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
Swagger Codegen is available for download in the GitHub repository, or can be generated for any new or existing OpenAPI-defined API in the integrated SwaggerHub platform.
The Swagger Codegen is an open source code-generator to build server stubs and client SDKs directly from a Swagger defined RESTful API. The source code for the Swagger Codegen can be found in GitHub.
Download the Swagger Codegen JAR File Download the latest version of the Swagger Codegen JAR 2.3. 0+. Windows users can use Invoke-WebRequest in PowerShell 3.0+ (e.g., Invoke-WebRequest -OutFile swagger-codegen-cli. jar http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.3.1/swagger-codegen-cli-2.3.1.jar).
# Swagger Codegen Ignore. # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen. # Use this file to prevent files from being overwritten by the generator.
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. )
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