diff --git a/README.md b/README.md index 27100ac43526..1dc55ede3974 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,21 @@ cd samples/petstore/scala mvn package +Do the same for `java` by running `./bin/java-petstore.sh` + + +#### Generating a client from flat files +If you don't want to call your server, you can save the swagger spec files into a directory and pass an argument +to the code generator like this: + +
+-DfileMap=/path/to/files
+
+
+Or for example:
+
+
+
 License
 -------
 
diff --git a/bin/java-petstore-filemap.sh b/bin/java-petstore-filemap.sh
new file mode 100755
index 000000000000..dc51420e72d6
--- /dev/null
+++ b/bin/java-petstore-filemap.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
+export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=src/test/resources/petstore "
+scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" src/main/scala/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
diff --git a/bin/java-petstore.sh b/bin/java-petstore.sh
index 80c20b0c0963..68e1d26f4767 100755
--- a/bin/java-petstore.sh
+++ b/bin/java-petstore.sh
@@ -1,16 +1,6 @@
 #!/bin/bash
-echo "" > classpath.txt
-for file in `ls target/*.jar`;
-        do echo -n '' >> classpath.txt;
-        echo -n $file >> classpath.txt;
-        echo -n ':' >> classpath.txt;
-done
-for file in `ls target/lib`;
-	do echo -n 'target/lib/' >> classpath.txt;
-	echo -n $file >> classpath.txt;
-	echo -n ':' >> classpath.txt;
-done
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 
-export CLASSPATH=$(cat classpath.txt)
+export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
 export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
 scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" src/main/scala/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
diff --git a/samples/petstore/java/pom.xml b/samples/petstore/java/pom.xml
new file mode 100644
index 000000000000..eb5ef7fe7614
--- /dev/null
+++ b/samples/petstore/java/pom.xml
@@ -0,0 +1,225 @@
+
+	4.0.0
+	com.wordnik
+	swagger-client
+	jar
+	swagger-client
+	1.0
+	
+		scm:git:git@github.com:wordnik/swagger-mustache.git
+		scm:git:git@github.com:wordnik/swagger-mustache.git
+		https://github.com/wordnik/swagger-mustache
+	
+	
+		2.2.0
+	
+
+	
+		
+			scala-tools.org
+			Scala-Tools Maven2 Repository
+			http://scala-tools.org/repo-releases
+		
+		
+			maven-mongodb-plugin-repo
+			maven mongodb plugin repository
+			http://maven-mongodb-plugin.googlecode.com/svn/maven/repo
+			default
+		
+	
+
+	
+		
+			
+				org.apache.maven.plugins
+				maven-surefire-plugin
+				2.12
+				
+					
+						
+							loggerPath
+							conf/log4j.properties
+						
+					
+					-Xms512m -Xmx1500m
+					methods
+					pertest
+				
+			
+			
+				maven-dependency-plugin
+				
+					
+						package
+						
+							copy-dependencies
+						
+						
+							${project.build.directory}/lib
+						
+					
+				
+			
+
+			
+			
+				org.apache.maven.plugins
+				maven-jar-plugin
+				2.2
+				
+					
+						
+							jar
+							test-jar
+						
+					
+				
+				
+				
+			
+
+			
+				org.codehaus.mojo
+				build-helper-maven-plugin
+				
+					
+						add_sources
+						generate-sources
+						
+							add-source
+						
+						
+							
+								src/main/java
+							
+						
+					
+					
+						add_test_sources
+						generate-test-sources
+						
+							add-test-source
+						
+						
+							
+								src/test/java
+							
+						
+					
+				
+			
+			
+				org.apache.maven.plugins
+				maven-compiler-plugin
+				2.3.2
+				
+					1.6
+					1.6
+				
+			
+			
+				org.scala-tools
+				maven-scala-plugin
+				2.15.2
+				
+					
+						scala-compile-first
+						process-resources
+						
+							add-source
+							compile
+						
+					
+					
+						scala-test-compile
+						process-test-resources
+						
+							testCompile
+						
+					
+				
+				
+					
+						-Xms128m
+						-Xmx1500m
+					
+				
+			
+		
+	
+	
+		
+			
+				org.scala-tools
+				maven-scala-plugin
+				
+					${scala-version}
+				
+			
+		
+	
+	
+    
+      com.sun.jersey
+      jersey-client
+      ${jersey-version}
+      compile
+    
+	  
+		  org.scala-lang
+		  scala-library
+		  ${scala-version}
+		  compile
+		
+		
+			com.wordnik
+			swagger-core_2.9.1
+			${swagger-core-version}
+			compile
+		
+		
+			org.scalatest
+			scalatest_2.9.1
+			${scala-test-version}
+			test
+		
+		
+			junit
+			junit
+			${junit-version}
+			test
+		
+	
+	
+		
+			scala-tools.org
+			Scala-Tools Maven2 Repository
+			http://scala-tools.org/repo-releases
+		
+		
+			wordnik-ci-aws
+			https://ci.aws.wordnik.com/artifactory/libs-snapshots/
+		
+		
+			wordnik-ci-aws-maven
+			https://ci.aws.wordnik.com/artifactory/m2-snapshots/
+		
+		
+			wordnik-ci-aws-remote
+			https://ci.aws.wordnik.com/artifactory/remote-repos/
+		
+	
+
+	
+    1.7
+    1.02-SNAPSHOT
+		2.9.1-1
+		4.8.1
+		1.0.0
+		1.6.1
+		4.8.1
+		1.6.1
+	
+
+
diff --git a/samples/petstore/java/src/main/java/com/wordnik/client/ApiException.java b/samples/petstore/java/src/main/java/com/wordnik/client/ApiException.java
new file mode 100644
index 000000000000..a0131b5cf8c4
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/client/ApiException.java
@@ -0,0 +1,29 @@
+package com.wordnik.client;
+
+public class ApiException extends Exception {
+  int code = 0;
+  String message = null;
+
+  public ApiException() {}
+
+  public ApiException(int code, String message) {
+    this.code = code;
+    this.message = message;
+  }
+
+  public int getCode() {
+    return code;
+  }
+  
+  public void setCode(int code) {
+    this.code = code;
+  }
+  
+  public String getMessage() {
+    return message;
+  }
+  
+  public void setMessage(String message) {
+    this.message = message;
+  }
+}
diff --git a/samples/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java b/samples/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java
new file mode 100644
index 000000000000..00e6d766a604
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java
@@ -0,0 +1,131 @@
+package com.wordnik.client;
+
+import com.wordnik.swagger.core.util.JsonUtil;
+
+import org.codehaus.jackson.type.JavaType;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.client.filter.LoggingFilter;
+import com.sun.jersey.api.client.WebResource.Builder;
+
+import javax.ws.rs.core.MediaType;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.io.IOException;
+
+public class ApiInvoker {
+  private static ApiInvoker INSTANCE = new ApiInvoker();
+  private Map hostMap = new HashMap();
+  private Map defaultHeaderMap = new HashMap();
+
+  public static ApiInvoker getInstance() {
+    return INSTANCE;
+  }
+  
+  public void addDefaultHeader(String key, String value) {
+	   defaultHeaderMap.put(key, value);
+  }
+
+  public String escapeString(String str) {
+    return str;
+  }
+
+  public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
+    try{
+      if("List".equals(containerType)) {
+        JavaType typeInfo = org.codehaus.jackson.map.type.TypeFactory.collectionType(List.class, cls);
+        List response = (List) JsonUtil.getJsonMapper().readValue(json, typeInfo);
+        return response;
+      }
+      else if(String.class.equals(cls)) {
+        if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1) {
+          return json.substring(1, json.length() - 2);
+        }
+        else 
+          return json;
+      }
+      else {
+        return JsonUtil.getJsonMapper().readValue(json, cls);
+      }
+    }
+    catch (IOException e) {
+      throw new ApiException(500, e.getMessage());
+    }
+  }
+
+  public static String serialize(Object obj) throws ApiException {
+    try {
+      if (obj != null) return JsonUtil.getJsonMapper().writeValueAsString(obj);
+      else return null;
+    }
+    catch (Exception e) {
+      throw new ApiException(500, e.getMessage());
+    }
+  }
+
+  public String invokeAPI(String host, String path, String method, Map queryParams, Object body, Map headerParams) throws ApiException {
+    Client client = getClient(host);
+
+    StringBuilder b = new StringBuilder();
+    
+    for(String key : queryParams.keySet()) {
+    	String value = queryParams.get(key);
+    	if (value != null){
+    		if(b.toString().length() == 0) b.append("?");
+    		else b.append("&");
+    		b.append(escapeString(key)).append("=").append(escapeString(value));
+    	}
+    }
+    String querystring = b.toString();
+
+    Builder builder = client.resource(host + path + querystring).type("application/json");
+    for(String key : headerParams.keySet()) {
+    	builder.header(key, headerParams.get(key));
+    }
+    
+    for(String key : defaultHeaderMap.keySet()) {
+    	if(!headerParams.containsKey(key)) {
+    		builder.header(key, defaultHeaderMap.get(key));
+    	}
+    }
+    ClientResponse response = null;
+
+    if("GET".equals(method)) {
+    	response = (ClientResponse) builder.get(ClientResponse.class);
+    }
+    else if ("POST".equals(method)) {
+        response = builder.post(ClientResponse.class, serialize(body));
+    }
+    else if ("PUT".equals(method)) {
+    	response = builder.put(ClientResponse.class, serialize(body));
+      }
+    else if ("DELETE".equals(method)) {
+        response = builder.delete(ClientResponse.class, serialize(body));
+    }
+    else {
+    	throw new ApiException(500, "unknown method type " + method);
+    }
+    if(response.getClientResponseStatus() == ClientResponse.Status.OK) {
+    	return (String) response.getEntity(String.class);
+    }
+    else {
+    	throw new ApiException(
+    	          response.getClientResponseStatus().getStatusCode(),
+    	          response.getEntity(String.class));    	
+    }
+  }
+
+  private Client getClient(String host) {
+	if(!hostMap.containsKey(host)) {
+		Client client = Client.create();
+		client.addFilter(new LoggingFilter());
+        hostMap.put(host, client);
+	}
+	return hostMap.get(host);
+  }
+}
diff --git a/samples/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java b/samples/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java
new file mode 100644
index 000000000000..1ceff6961581
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java
@@ -0,0 +1,174 @@
+package com.wordnik.petstore.api;
+
+import com.wordnik.client.ApiException;
+import com.wordnik.client.ApiInvoker;
+import com.wordnik.petstore.model.Pet;
+import java.util.*;
+
+public class PetApi {
+  String basePath = "http://petstore.swagger.wordnik.com/api";
+  ApiInvoker apiInvoker = ApiInvoker.getInstance();
+
+  public ApiInvoker getInvoker() {
+    return apiInvoker;
+  }
+  
+  public void setBasePath(String basePath) {
+    this.basePath = basePath;
+  }
+  
+  public String getBasePath() {
+    return basePath;
+  }
+
+  public Pet getPetById (String petId) throws ApiException {
+    // create path and map variables
+    String path = "/pet.{format}/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId));
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(petId == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
+      if(response != null){
+        return (Pet) ApiInvoker.deserialize(response, "", Pet.class);
+      }
+      else {
+        return null;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return null;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void addPet (Pet body) throws ApiException {
+    // create path and map variables
+    String path = "/pet.{format}".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(body == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void updatePet (Pet body) throws ApiException {
+    // create path and map variables
+    String path = "/pet.{format}".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(body == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public List findPetsByStatus (String status) throws ApiException {
+    // create path and map variables
+    String path = "/pet.{format}/findByStatus".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(status == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    if(!"null".equals(String.valueOf(status)))
+      queryParams.put("status", String.valueOf(status));
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
+      if(response != null){
+        return (List) ApiInvoker.deserialize(response, "List", Pet.class);
+      }
+      else {
+        return null;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return null;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public List findPetsByTags (String tags) throws ApiException {
+    // create path and map variables
+    String path = "/pet.{format}/findByTags".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(tags == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    if(!"null".equals(String.valueOf(tags)))
+      queryParams.put("tags", String.valueOf(tags));
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
+      if(response != null){
+        return (List) ApiInvoker.deserialize(response, "List", Pet.class);
+      }
+      else {
+        return null;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return null;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  }
+
diff --git a/samples/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java b/samples/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java
new file mode 100644
index 000000000000..f307ee55fefd
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java
@@ -0,0 +1,112 @@
+package com.wordnik.petstore.api;
+
+import com.wordnik.client.ApiException;
+import com.wordnik.client.ApiInvoker;
+import com.wordnik.petstore.model.Order;
+import java.util.*;
+
+public class StoreApi {
+  String basePath = "http://petstore.swagger.wordnik.com/api";
+  ApiInvoker apiInvoker = ApiInvoker.getInstance();
+
+  public ApiInvoker getInvoker() {
+    return apiInvoker;
+  }
+  
+  public void setBasePath(String basePath) {
+    this.basePath = basePath;
+  }
+  
+  public String getBasePath() {
+    return basePath;
+  }
+
+  public Order getOrderById (String orderId) throws ApiException {
+    // create path and map variables
+    String path = "/store.{format}/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId));
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(orderId == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
+      if(response != null){
+        return (Order) ApiInvoker.deserialize(response, "", Order.class);
+      }
+      else {
+        return null;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return null;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void deleteOrder (String orderId) throws ApiException {
+    // create path and map variables
+    String path = "/store.{format}/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId));
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(orderId == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void placeOrder (Order body) throws ApiException {
+    // create path and map variables
+    String path = "/store.{format}/order".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(body == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  }
+
diff --git a/samples/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java b/samples/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java
new file mode 100644
index 000000000000..15c87f0028cd
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java
@@ -0,0 +1,257 @@
+package com.wordnik.petstore.api;
+
+import com.wordnik.client.ApiException;
+import com.wordnik.client.ApiInvoker;
+import com.wordnik.petstore.model.User;
+import java.util.*;
+
+public class UserApi {
+  String basePath = "http://petstore.swagger.wordnik.com/api";
+  ApiInvoker apiInvoker = ApiInvoker.getInstance();
+
+  public ApiInvoker getInvoker() {
+    return apiInvoker;
+  }
+  
+  public void setBasePath(String basePath) {
+    this.basePath = basePath;
+  }
+  
+  public String getBasePath() {
+    return basePath;
+  }
+
+  public void createUsersWithArrayInput (List body) throws ApiException {
+    // create path and map variables
+    String path = "/user.{format}/createWithArray".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(body == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void createUser (User body) throws ApiException {
+    // create path and map variables
+    String path = "/user.{format}".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(body == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void createUsersWithListInput (List body) throws ApiException {
+    // create path and map variables
+    String path = "/user.{format}/createWithList".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(body == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void updateUser (String username, User body) throws ApiException {
+    // create path and map variables
+    String path = "/user.{format}/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username));
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(username == null || body == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void deleteUser (String username) throws ApiException {
+    // create path and map variables
+    String path = "/user.{format}/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username));
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(username == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public User getUserByName (String username) throws ApiException {
+    // create path and map variables
+    String path = "/user.{format}/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username));
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(username == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
+      if(response != null){
+        return (User) ApiInvoker.deserialize(response, "", User.class);
+      }
+      else {
+        return null;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return null;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public String loginUser (String username, String password) throws ApiException {
+    // create path and map variables
+    String path = "/user.{format}/login".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    // verify required params are set
+    if(username == null || password == null ) {
+       throw new ApiException(400, "missing required params");
+    }
+    if(!"null".equals(String.valueOf(username)))
+      queryParams.put("username", String.valueOf(username));
+    if(!"null".equals(String.valueOf(password)))
+      queryParams.put("password", String.valueOf(password));
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
+      if(response != null){
+        return (String) ApiInvoker.deserialize(response, "", String.class);
+      }
+      else {
+        return null;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return null;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  public void logoutUser () throws ApiException {
+    // create path and map variables
+    String path = "/user.{format}/logout".replaceAll("\\{format\\}","json");
+
+    // query params
+    Map queryParams = new HashMap();
+    Map headerParams = new HashMap();
+
+    try {
+      String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
+      if(response != null){
+        return ;
+      }
+      else {
+        return ;
+      }
+    } catch (ApiException ex) {
+      if(ex.getCode() == 404) {
+      	return ;
+      }
+      else {
+        throw ex;
+      }
+    }
+  }
+  }
+
diff --git a/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Category.java b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Category.java
new file mode 100644
index 000000000000..aa9303084bbd
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Category.java
@@ -0,0 +1,30 @@
+package com.wordnik.petstore.model;
+
+public class Category {
+  private Long id = null;
+  private String name = null;
+  public Long getId() {
+    return id;
+  }
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public String getName() {
+    return name;
+  }
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  @Override
+  public String toString()  {
+    StringBuilder sb = new StringBuilder();
+    sb.append("class Category {\n");
+    sb.append("  id: ").append(id).append("\n");
+    sb.append("  name: ").append(name).append("\n");
+    sb.append("}\n");
+    return sb.toString();
+  }
+}
+
diff --git a/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Order.java b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Order.java
new file mode 100644
index 000000000000..4d8c59a03bc7
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Order.java
@@ -0,0 +1,59 @@
+package com.wordnik.petstore.model;
+
+import java.util.Date;
+public class Order {
+  private Long id = null;
+  private Long petId = null;
+  /* Order Status */
+  private String status = null;
+  private Integer quantity = null;
+  private Date shipDate = null;
+  public Long getId() {
+    return id;
+  }
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public Long getPetId() {
+    return petId;
+  }
+  public void setPetId(Long petId) {
+    this.petId = petId;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public Integer getQuantity() {
+    return quantity;
+  }
+  public void setQuantity(Integer quantity) {
+    this.quantity = quantity;
+  }
+
+  public Date getShipDate() {
+    return shipDate;
+  }
+  public void setShipDate(Date shipDate) {
+    this.shipDate = shipDate;
+  }
+
+  @Override
+  public String toString()  {
+    StringBuilder sb = new StringBuilder();
+    sb.append("class Order {\n");
+    sb.append("  id: ").append(id).append("\n");
+    sb.append("  petId: ").append(petId).append("\n");
+    sb.append("  status: ").append(status).append("\n");
+    sb.append("  quantity: ").append(quantity).append("\n");
+    sb.append("  shipDate: ").append(shipDate).append("\n");
+    sb.append("}\n");
+    return sb.toString();
+  }
+}
+
diff --git a/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Pet.java b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Pet.java
new file mode 100644
index 000000000000..ae54341612dc
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Pet.java
@@ -0,0 +1,70 @@
+package com.wordnik.petstore.model;
+
+import java.util.*;
+import com.wordnik.petstore.model.Category;
+import com.wordnik.petstore.model.Tag;
+public class Pet {
+  private Long id = null;
+  private List tags = new ArrayList();
+  private Category category = null;
+  /* pet status in the store */
+  private String status = null;
+  private String name = null;
+  private List photoUrls = new ArrayList();
+  public Long getId() {
+    return id;
+  }
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public List getTags() {
+    return tags;
+  }
+  public void setTags(List tags) {
+    this.tags = tags;
+  }
+
+  public Category getCategory() {
+    return category;
+  }
+  public void setCategory(Category category) {
+    this.category = category;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public String getName() {
+    return name;
+  }
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public List getPhotoUrls() {
+    return photoUrls;
+  }
+  public void setPhotoUrls(List photoUrls) {
+    this.photoUrls = photoUrls;
+  }
+
+  @Override
+  public String toString()  {
+    StringBuilder sb = new StringBuilder();
+    sb.append("class Pet {\n");
+    sb.append("  id: ").append(id).append("\n");
+    sb.append("  tags: ").append(tags).append("\n");
+    sb.append("  category: ").append(category).append("\n");
+    sb.append("  status: ").append(status).append("\n");
+    sb.append("  name: ").append(name).append("\n");
+    sb.append("  photoUrls: ").append(photoUrls).append("\n");
+    sb.append("}\n");
+    return sb.toString();
+  }
+}
+
diff --git a/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Tag.java b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Tag.java
new file mode 100644
index 000000000000..886a5a6513be
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/Tag.java
@@ -0,0 +1,30 @@
+package com.wordnik.petstore.model;
+
+public class Tag {
+  private Long id = null;
+  private String name = null;
+  public Long getId() {
+    return id;
+  }
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public String getName() {
+    return name;
+  }
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  @Override
+  public String toString()  {
+    StringBuilder sb = new StringBuilder();
+    sb.append("class Tag {\n");
+    sb.append("  id: ").append(id).append("\n");
+    sb.append("  name: ").append(name).append("\n");
+    sb.append("}\n");
+    return sb.toString();
+  }
+}
+
diff --git a/samples/petstore/java/src/main/java/com/wordnik/petstore/model/User.java b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/User.java
new file mode 100644
index 000000000000..7c96c958e3a2
--- /dev/null
+++ b/samples/petstore/java/src/main/java/com/wordnik/petstore/model/User.java
@@ -0,0 +1,85 @@
+package com.wordnik.petstore.model;
+
+public class User {
+  private Long id = null;
+  private String lastName = null;
+  private String username = null;
+  private String phone = null;
+  private String email = null;
+  /* User Status */
+  private Integer userStatus = null;
+  private String firstName = null;
+  private String password = null;
+  public Long getId() {
+    return id;
+  }
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public String getLastName() {
+    return lastName;
+  }
+  public void setLastName(String lastName) {
+    this.lastName = lastName;
+  }
+
+  public String getUsername() {
+    return username;
+  }
+  public void setUsername(String username) {
+    this.username = username;
+  }
+
+  public String getPhone() {
+    return phone;
+  }
+  public void setPhone(String phone) {
+    this.phone = phone;
+  }
+
+  public String getEmail() {
+    return email;
+  }
+  public void setEmail(String email) {
+    this.email = email;
+  }
+
+  public Integer getUserStatus() {
+    return userStatus;
+  }
+  public void setUserStatus(Integer userStatus) {
+    this.userStatus = userStatus;
+  }
+
+  public String getFirstName() {
+    return firstName;
+  }
+  public void setFirstName(String firstName) {
+    this.firstName = firstName;
+  }
+
+  public String getPassword() {
+    return password;
+  }
+  public void setPassword(String password) {
+    this.password = password;
+  }
+
+  @Override
+  public String toString()  {
+    StringBuilder sb = new StringBuilder();
+    sb.append("class User {\n");
+    sb.append("  id: ").append(id).append("\n");
+    sb.append("  lastName: ").append(lastName).append("\n");
+    sb.append("  username: ").append(username).append("\n");
+    sb.append("  phone: ").append(phone).append("\n");
+    sb.append("  email: ").append(email).append("\n");
+    sb.append("  userStatus: ").append(userStatus).append("\n");
+    sb.append("  firstName: ").append(firstName).append("\n");
+    sb.append("  password: ").append(password).append("\n");
+    sb.append("}\n");
+    return sb.toString();
+  }
+}
+
diff --git a/src/main/resources/java/api.mustache b/src/main/resources/javaTemplates/api.mustache
similarity index 100%
rename from src/main/resources/java/api.mustache
rename to src/main/resources/javaTemplates/api.mustache
diff --git a/src/main/resources/javaTemplates/apiException.mustache b/src/main/resources/javaTemplates/apiException.mustache
new file mode 100644
index 000000000000..9a1f62b3061e
--- /dev/null
+++ b/src/main/resources/javaTemplates/apiException.mustache
@@ -0,0 +1,29 @@
+package com.wordnik.client;
+
+public class ApiException extends Exception {
+  int code = 0;
+  String message = null;
+
+  public ApiException() {}
+
+  public ApiException(int code, String message) {
+    this.code = code;
+    this.message = message;
+  }
+
+  public int getCode() {
+    return code;
+  }
+  
+  public void setCode(int code) {
+    this.code = code;
+  }
+  
+  public String getMessage() {
+    return message;
+  }
+  
+  public void setMessage(String message) {
+    this.message = message;
+  }
+}
\ No newline at end of file
diff --git a/src/main/resources/java/apiInvoker.mustache b/src/main/resources/javaTemplates/apiInvoker.mustache
similarity index 95%
rename from src/main/resources/java/apiInvoker.mustache
rename to src/main/resources/javaTemplates/apiInvoker.mustache
index d74de63faa32..f4349548fa75 100644
--- a/src/main/resources/java/apiInvoker.mustache
+++ b/src/main/resources/javaTemplates/apiInvoker.mustache
@@ -43,7 +43,11 @@ public class ApiInvoker {
         return response;
       }
       else if(String.class.equals(cls)) {
-        return json;
+        if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1) {
+          return json.substring(1, json.length() - 2);
+        }
+        else 
+          return json;
       }
       else {
         return JsonUtil.getJsonMapper().readValue(json, cls);
diff --git a/src/main/resources/java/model.mustache b/src/main/resources/javaTemplates/model.mustache
similarity index 100%
rename from src/main/resources/java/model.mustache
rename to src/main/resources/javaTemplates/model.mustache
diff --git a/src/main/resources/java/pom.mustache b/src/main/resources/javaTemplates/pom.mustache
similarity index 100%
rename from src/main/resources/java/pom.mustache
rename to src/main/resources/javaTemplates/pom.mustache
diff --git a/src/main/scala/JavaPetstoreCodegen.scala b/src/main/scala/JavaPetstoreCodegen.scala
new file mode 100644
index 000000000000..cb7160b4184d
--- /dev/null
+++ b/src/main/scala/JavaPetstoreCodegen.scala
@@ -0,0 +1,28 @@
+import com.wordnik.swagger.codegen.BasicJavaGenerator
+
+import com.wordnik.swagger.core._
+
+object JavaPetstoreCodegen extends BasicJavaGenerator {
+  def main(args: Array[String]) = generateClient(args)
+
+  override def packageName = "com.wordnik.petstore"
+
+  // location of templates
+  override def templateDir = "javaTemplates/"
+
+  // where to write generated code
+  override def destinationDir = "samples/petstore/java/src/main/java"
+
+  // package for models
+  override def modelPackage = Some("com.wordnik.petstore.model")
+
+  // package for api classes
+  override def apiPackage = Some("com.wordnik.petstore.api")
+
+  // supporting classes
+  override def supportingFiles =
+    List(
+      ("apiInvoker.mustache", "samples/petstore/java/src/main/java/com/wordnik/client", "ApiInvoker.java"),
+      ("apiException.mustache", "samples/petstore/java/src/main/java/com/wordnik/client", "ApiException.java"),
+      ("pom.mustache", "samples/petstore/java", "pom.xml"))
+}
\ No newline at end of file
diff --git a/src/main/scala/JavaCodegen.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicJavaGenerator.scala
similarity index 81%
rename from src/main/scala/JavaCodegen.scala
rename to src/main/scala/com/wordnik/swagger/codegen/BasicJavaGenerator.scala
index 3296c53c4483..9e3ef3bf6c64 100644
--- a/src/main/scala/JavaCodegen.scala
+++ b/src/main/scala/com/wordnik/swagger/codegen/BasicJavaGenerator.scala
@@ -14,15 +14,15 @@
  *  limitations under the License.
  */
 
-import com.wordnik.swagger.codegen.BasicGenerator
+package com.wordnik.swagger.codegen
 
 import com.wordnik.swagger.core._
 
-object JavaCodegen extends JavaCodegen {
+object BasicJavaGenerator extends BasicJavaGenerator {
   def main(args: Array[String]) = generateClient(args)
 }
 
-class JavaCodegen extends BasicGenerator {
+class BasicJavaGenerator extends BasicGenerator {
   override def defaultIncludes = Set(
     "double",
     "int",
@@ -32,13 +32,17 @@ class JavaCodegen extends BasicGenerator {
     "boolean")
 
   override def typeMapping = Map(
-    "Int" -> "int",
-    "string" -> "String")
+    "string" -> "String",
+    "int" -> "Integer",
+    "float" -> "Float",
+    "long" -> "Long",
+    "double" -> "Double",
+    "object" -> "Object")
 
   override def packageName = "com.wordnik.client"
 
   // location of templates
-  override def templateDir = "src/main/resources/java"
+  override def templateDir = "javaTemplates"
 
   // template used for models
   modelTemplateFiles += "model.mustache" -> ".java"
@@ -57,10 +61,10 @@ class JavaCodegen extends BasicGenerator {
     "List" -> "java.util.List")
 
   // package for models
-  override def modelPackage = Some("com.wordnik.javaPetstore.model")
+  override def modelPackage = Some("com.wordnik.model")
 
   // package for api classes
-  override def apiPackage = Some("com.wordnik.javaPetstore.api")
+  override def apiPackage = Some("com.wordnik.api")
 
   // file suffix
   override def fileSuffix = ".java"
@@ -69,14 +73,14 @@ class JavaCodegen extends BasicGenerator {
   override def processResponseClass(responseClass: String): Option[String] = {
     responseClass match {
       case "void" => None
-      case e: String => Some(e.replaceAll("\\[", "<").replaceAll("\\]", ">"))
+      case e: String => Some(typeMapping.getOrElse(e, e.replaceAll("\\[", "<").replaceAll("\\]", ">")))
     }
   }
 
   override def processResponseDeclaration(responseClass: String): Option[String] = {
     responseClass match {
       case "void" => None
-      case e: String => Some(e.replaceAll("\\[", "<").replaceAll("\\]", ">"))
+      case e: String => Some(typeMapping.getOrElse(e, e.replaceAll("\\[", "<").replaceAll("\\]", ">")))
     }
   }
 
@@ -86,11 +90,11 @@ class JavaCodegen extends BasicGenerator {
       case n: Int => {
         if (dt.substring(0, n) == "Array") {
           "List" + dt.substring(n).replaceAll("\\[", "<").replaceAll("\\]", ">")
-        } else dt + dt.substring(1).replaceAll("\\[", "<").replaceAll("\\]", ">")
+        } 
+        else dt.replaceAll("\\[", "<").replaceAll("\\]", ">")
       }
       case _ => dt
     }
-    println("mapping: ", declaredType, typeMapping.getOrElse(declaredType, declaredType))
     typeMapping.getOrElse(declaredType, declaredType)
   }
 
diff --git a/src/test/resources/petstore/pet.json b/src/test/resources/petstore/pet.json
new file mode 100644
index 000000000000..9a56191345f0
--- /dev/null
+++ b/src/test/resources/petstore/pet.json
@@ -0,0 +1 @@
+{"apiVersion":"0.2","swaggerVersion":"1.1","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/pet","apis":[{"path":"/pet.{format}/{petId}","description":"Operations about pets","operations":[{"httpMethod":"GET","summary":"Find pet by ID","notes":"Returns a pet based on ID","responseClass":"Pet","nickname":"getPetById","parameters":[{"name":"petId","description":"ID of pet that needs to be fetched","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid ID supplied"},{"code":404,"reason":"Pet not found"}]}]},{"path":"/pet.{format}","description":"Operations about pets","operations":[{"httpMethod":"POST","summary":"Add a new pet to the store","responseClass":"void","nickname":"addPet","parameters":[{"description":"Pet object that needs to be added to the store","paramType":"body","required":true,"allowMultiple":false,"dataType":"Pet"}],"errorResponses":[{"code":405,"reason":"Invalid input"}]},{"httpMethod":"PUT","summary":"Update an existing pet","responseClass":"void","nickname":"updatePet","parameters":[{"description":"Pet object that needs to be updated in the store","paramType":"body","required":true,"allowMultiple":false,"dataType":"Pet"}],"errorResponses":[{"code":400,"reason":"Invalid ID supplied"},{"code":404,"reason":"Pet not found"},{"code":405,"reason":"Validation exception"}]}]},{"path":"/pet.{format}/findByStatus","description":"Operations about pets","operations":[{"httpMethod":"GET","summary":"Finds Pets by status","notes":"Multiple status values can be provided with comma seperated strings","responseClass":"List[Pet]","nickname":"findPetsByStatus","parameters":[{"name":"status","description":"Status values that need to be considered for filter","paramType":"query","defaultValue":"available","allowableValues":{"valueType":"LIST","values":["available","pending","sold"],"valueType":"LIST"},"required":true,"allowMultiple":true,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid status value"}]}]},{"path":"/pet.{format}/findByTags","description":"Operations about pets","operations":[{"httpMethod":"GET","summary":"Finds Pets by tags","notes":"Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.","deprecated":true,"responseClass":"List[Pet]","nickname":"findPetsByTags","parameters":[{"name":"tags","description":"Tags to filter by","paramType":"query","required":true,"allowMultiple":true,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid tag value"}]}]}],"models":{"Category":{"id":"Category","properties":{"id":{"type":"long"},"name":{"type":"string"}}},"Pet":{"id":"Pet","properties":{"tags":{"items":{"$ref":"Tag"},"type":"Array"},"id":{"type":"long"},"category":{"type":"Category"},"status":{"allowableValues":{"valueType":"LIST","values":["available","pending","sold"],"valueType":"LIST"},"description":"pet status in the store","type":"string"},"name":{"type":"string"},"photoUrls":{"items":{"type":"string"},"type":"Array"}}},"Tag":{"id":"Tag","properties":{"id":{"type":"long"},"name":{"type":"string"}}}}}
\ No newline at end of file
diff --git a/src/test/resources/petstore/resources.json b/src/test/resources/petstore/resources.json
new file mode 100644
index 000000000000..7428f7188685
--- /dev/null
+++ b/src/test/resources/petstore/resources.json
@@ -0,0 +1 @@
+{"apiVersion":"0.2","swaggerVersion":"1.1","basePath":"http://petstore.swagger.wordnik.com/api","apis":[{"path":"/store.{format}","description":"Operations about store"},{"path":"/pet.{format}","description":"Operations about pets"},{"path":"/user.{format}","description":"Operations about user"}]}
\ No newline at end of file
diff --git a/src/test/resources/petstore/store.json b/src/test/resources/petstore/store.json
new file mode 100644
index 000000000000..ad85d33fef35
--- /dev/null
+++ b/src/test/resources/petstore/store.json
@@ -0,0 +1 @@
+{"apiVersion":"0.2","swaggerVersion":"1.1","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/store","apis":[{"path":"/store.{format}/order/{orderId}","description":"Operations about store","operations":[{"httpMethod":"GET","summary":"Find purchase order by ID","notes":"For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors","responseClass":"Order","nickname":"getOrderById","parameters":[{"name":"orderId","description":"ID of pet that needs to be fetched","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid ID supplied"},{"code":404,"reason":"Order not found"}]},{"httpMethod":"DELETE","summary":"Delete purchase order by ID","notes":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","responseClass":"void","nickname":"deleteOrder","parameters":[{"name":"orderId","description":"ID of the order that needs to be deleted","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid ID supplied"},{"code":404,"reason":"Order not found"}]}]},{"path":"/store.{format}/order","description":"Operations about store","operations":[{"httpMethod":"POST","summary":"Place an order for a pet","responseClass":"void","nickname":"placeOrder","parameters":[{"description":"order placed for purchasing the pet","paramType":"body","required":true,"allowMultiple":false,"dataType":"Order"}],"errorResponses":[{"code":400,"reason":"Invalid order"}]}]}],"models":{"Order":{"id":"Order","properties":{"id":{"type":"long"},"petId":{"type":"long"},"status":{"allowableValues":{"valueType":"LIST","values":["placed"," approved"," delivered"],"valueType":"LIST"},"description":"Order Status","type":"string"},"quantity":{"type":"int"},"shipDate":{"type":"Date"}}}}}
\ No newline at end of file
diff --git a/src/test/resources/petstore/user.json b/src/test/resources/petstore/user.json
new file mode 100644
index 000000000000..b90b18d1bbef
--- /dev/null
+++ b/src/test/resources/petstore/user.json
@@ -0,0 +1 @@
+{"apiVersion":"0.2","swaggerVersion":"1.1","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/user","apis":[{"path":"/user.{format}/createWithArray","description":"Operations about user","operations":[{"httpMethod":"POST","summary":"Creates list of users with given input array","responseClass":"void","nickname":"createUsersWithArrayInput","parameters":[{"description":"List of user object","paramType":"body","required":true,"allowMultiple":false,"dataType":"Array[User]"}]}]},{"path":"/user.{format}","description":"Operations about user","operations":[{"httpMethod":"POST","summary":"Create user","notes":"This can only be done by the logged in user.","responseClass":"void","nickname":"createUser","parameters":[{"description":"Created user object","paramType":"body","required":true,"allowMultiple":false,"dataType":"User"}]}]},{"path":"/user.{format}/createWithList","description":"Operations about user","operations":[{"httpMethod":"POST","summary":"Creates list of users with given list input","responseClass":"void","nickname":"createUsersWithListInput","parameters":[{"description":"List of user object","paramType":"body","required":true,"allowMultiple":false,"dataType":"List[User]"}]}]},{"path":"/user.{format}/{username}","description":"Operations about user","operations":[{"httpMethod":"PUT","summary":"Updated user","notes":"This can only be done by the logged in user.","responseClass":"void","nickname":"updateUser","parameters":[{"name":"username","description":"name that need to be deleted","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"},{"description":"Updated user object","paramType":"body","required":true,"allowMultiple":false,"dataType":"User"}],"errorResponses":[{"code":400,"reason":"Invalid username supplied"},{"code":404,"reason":"User not found"}]},{"httpMethod":"DELETE","summary":"Delete user","notes":"This can only be done by the logged in user.","responseClass":"void","nickname":"deleteUser","parameters":[{"name":"username","description":"The name that needs to be deleted","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid username supplied"},{"code":404,"reason":"User not found"}]},{"httpMethod":"GET","summary":"Get user by user name","responseClass":"User","nickname":"getUserByName","parameters":[{"name":"username","description":"The name that needs to be fetched. Use user1 for testing.","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid username supplied"},{"code":404,"reason":"User not found"}]}]},{"path":"/user.{format}/login","description":"Operations about user","operations":[{"httpMethod":"GET","summary":"Logs user into the system","responseClass":"string","nickname":"loginUser","parameters":[{"name":"username","description":"The user name for login","paramType":"query","required":true,"allowMultiple":false,"dataType":"string"},{"name":"password","description":"The password for login in clear text","paramType":"query","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid username and password combination"}]}]},{"path":"/user.{format}/logout","description":"Operations about user","operations":[{"httpMethod":"GET","summary":"Logs out current logged in user session","responseClass":"void","nickname":"logoutUser"}]}],"models":{"User":{"id":"User","properties":{"id":{"type":"Long"},"lastName":{"type":"string"},"phone":{"type":"string"},"username":{"type":"string"},"email":{"type":"string"},"userStatus":{"allowableValues":{"valueType":"LIST","values":["1-registered","2-active","3-closed"],"valueType":"LIST"},"description":"User Status","type":"int"},"firstName":{"type":"string"},"password":{"type":"string"}}}}}
\ No newline at end of file