My scenario is the following.
I have a swagger .json eg.: http://petstore.swagger.io/v2/swagger.json I want to use a generated java client for the REST API above, li
Instead of using the JAR, you can also use https://generator.swagger.io to generate the SDKs (Java, Ruby, PHP, etc) online without installing anything. Here is an example:
curl -X POST -H "content-type:application/json" -d '{"swaggerUrl":"http://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/java
and here is a sample response:
{"code":"1445940806041","link":"https://generator.swagger.io/api/gen/download/1445940806041"}
You can then download the zipped SDK from the link.
For more options on customizing the output of https://generator.swagger.io, please refer to https://github.com/swagger-api/swagger-codegen#online-generators
(Swagger Generator is part of the Swagger Codegen project (free, open source) that you can run your local Swagger generator as well)
As of July 2017, the Java API client generator supports the following HTTP libraries: Jersey 1.x & 2.x, Retrofit 1.x & 2.x, okhttp, Feign, RESTEasy, RestTemplate