How to fix java.lang.RuntimeException: missing swagger input or config? - swagger

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

Related

Swagger With Karaf Integration

I am trying to integrate Karaf with Swagger for Rest-API Documentation following the link :http://cxf.apache.org/docs/swagger2feature.html
I am ussing cxf 3.1.3. I am unable to find the swagger as a karaf feature.
i tried to resolve the swagger dependencies but unable to succeed.
Any Help?
There's a swagger 2.11 feature already configured at the servicemix repository, you can install it with the following steps:
feature:repo-add mvn:org.apache.servicemix.features/servicemix-features/7.0.1/xml/features
feature:install swagger-2.11

Grails 3.1.5 dont produces jar file

In version to 3.1.5, the command "package" not produces a jar file in "project/build/libs"
I ran a simple "create-app" and "package" with versions 3.0.9 and 3.1.5. Only the first produces a jar file. No error appears in both.
Someone knows how I create a executable JAR, in version 3.1.5?
The documentation states...
If you prefer not to operate a separate Servlet container then you can
simply run the Grails WAR file as a regular Java application.
And then provides the following example:
grails war
java -Dgrails.env=prod -jar build/libs/mywar-0.1.war
So basically, the generated war file is a jar file.

Grails 3.0.10 can't resolve MockFor

I'm trying to port an existing Grails 2.2 plugin to Grails 3.0. As such, I would prefer to avoid rewriting its unit tests, which use MockFor
Having created a new 3.0.10 plugin with grails create-plugin, and copied the source files into the appropriate new locations, when I run grails test-app I get:
{path}/FooControllerTests.groovy: 4: unable to resolve class groovy.mock.interceptor.MockFor
# line 4, column 1.
import groovy.mock.interceptor.MockFor
^
I haven't yet done anything to build.gradle.
$ grails --version
| Grails Version: 3.0.10
| Groovy Version: 2.4.5
| JVM Version: 1.7.0_91
... the Groovy 2.4.5 API docs show groovy.mock.interceptor.MockFor should be present: http://docs.groovy-lang.org/2.4.5/html/gapi/index.html?groovy/mock/interceptor/MockFor
What am I missing?
EDIT:
Modifying gradle.properties and changing grailsVersion to 3.0.9 seems to work (regardless of whether I tell SDK to use 3.0.9 or 3.0.10).
I had a similar problem. A plugin was pulling in a older version of Groovy (2.3.X). I had to find it and exclude the groovy required by that plugin.
My build.gradle file now has this:
compile("org.gebish:geb-junit4:0.10.0") {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
I found this with the gradle dependencies command. I looked for the groovy-all entries and found the plugin that forced an older version of groovy.

How to Install cxf:1.1.1 server in Grails 2.3.0

I tried to install the plugin for cxf server in order to expose some grails services as SOAP web services, according to Grails 2.3 the new plugin installation is:
compile ":cxf:1.1.1"
in plugins section of BuildConfig.groovy, however it does not work, I tried to expose a service and the annotations are not recognized, I am working with GGTS (Groovy Grails Tool Suite) and I can't see the plugin installed under the plugin section.
My environment is Grails 2.3, Java 7, Groovy 2.1
Has anybody tried this plugin using Grails 2.3.0 and stumbled upon this issue in GGTS?
In order for the annotations to be recognized you'll need to import the following libraries into the interface or service class you're using to expose the endpoint:
import javax.jws.WebService
import org.grails.cxf.utils.EndpointType
import org.grails.cxf.utils.GrailsCxfEndpoint
The plugin should show up in the plugins dir if you refresh the dependencies for the project.

Can't run DynaForm - BUILD FAILED - Ant

To run the sample application of DynaForm (a dynamic web form generator) I followed the readme instruction:
DynaForm - a dynamic web form genrator
To run the sample application use your command line and type "ant".
Then open localhost:2000/ on your browser.
The build script requires ANT and JDK (at least Java 1.6) to be in the path.
The DynaForm's project site is hostet at:
http://code.google.com/p/xsd-web-forms/
Rein Raudjärv
May 23 2010
In my Mac I have ANT and JDK (with Java 1.6). When launch in my command line "ant" I have this error:
BUILD FAILED
/Users/colet/Desktop/dynaform/build.xml:64: /Users/colet/Desktop/dynaform/${env.ANT_HOME}/lib does not exist.
Maybe I misunderstood the sentence:
The build script requires ANT and JDK (at least Java 1.6) to be in the path.
what does "to be in the path" mean?
Thanks!
Please clone the DynaForm project from GitHub instead of Google Code:
https://github.com/reinra/dynaform
The newer version builds via Maven instead of Ant, so it's simpler and should work better.
Check that you have defined ANT_HOME environment variable correctly. Refer to Ant installation instructions, if needed.

Resources