# Swagger Code Generator [![Build Status](https://travis-ci.org/swagger-api/swagger-codegen.png)](https://travis-ci.org/swagger-api/swagger-codegen) ## Overview This is the swagger codegen project, which allows generation of client libraries automatically from a Swagger-compliant server. ## What's Swagger? The goal of Swaggerâ„¢ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service. Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more. ## Compatability The Swagger Specification has undergone 3 revisions since initial creation in 2010. The swagger-codegen project has the following compatibilies with the swagger specification: Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes ----------------------- | ------------ | -------------------------- | ----- 2.1.3-M1-SNAPSHOT | 2015-02-23 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.0-M1](https://github.com/swagger-api/swagger-codegen) 2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17) 1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1) ### Prerequisites You need the following installed and available in your $PATH: * [Java 7](http://java.oracle.com) * [Apache maven 3.0.3 or greater](http://maven.apache.org/) After cloning the project, you can build it from source with this command: ``` mvn package ``` ### To generate a sample client library You can build a client against the swagger sample [petstore](http://petstore.swagger.io) API as follows: ``` ./bin/java-petstore.sh ``` This will run the generator with this command: ``` java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -i http://petstore.swagger.io/v2/swagger.json \ -l java \ -o samples/client/petstore/java ``` With a number of options. You can get the options with the `help generate` command: ``` NAME swagger generate - Generate code with chosen lang SYNOPSIS swagger generate [(-a | --auth )] (-i | --input-spec ) (-l | --lang ) [(-o | --output )] [(-t