title: How to generate java client code for swagger REST API documentation
body: <p>My scenario is the following.</p>
  
  <p>I have a swagger .json eg.: <a href="http://petstore.swagger.io/v2/swagger.json" rel="noreferrer">http://petstore.swagger.io/v2/swagger.json</a>
  I want to use a generated java client for the REST API above, like:</p>
  
  <pre><code>PetApi petApi = new PetApi();
  Pet pet = new Pet;
  pet.setName("cica");
  pet.setId(1L);
  petApi.addPet(pet);
  System.out.println(petApi.getById(1L));`
  </code></pre>
  
  <p>Expexted output: <code>cica</code> and the new pet is stored according to the REST API implmentation.</p>
  
  <p>I have successfully generated server stub for the petstore with the command:</p>
  
  <pre><code>java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate
       -i http://petstore.swagger.io/v2/swagger.json
       -l spring-mvc
       -o samples/server/petstore/spring-mvc
  </code></pre>
  
  <p>But this maven project code is a server code. It has annotations like <code>@RequestMapping</code> in <code>PetApi.java</code> and also has a <code>WebMvcConfiguration.class</code>.</p>
  
  <p>I do not want to have a server-stub. I want to have a client-library for the petstore REST API.</p>
  
  <p>Is there a tool which can generate the appropriate client library for me? Should I modify the server-stub, hence it has all the models or should I use a simple springRestTemplate?</p>
  
  <p>Thanks for the answers!</p>