diff --git a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Api/PetApi.cs b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Api/PetApi.cs
index b8139909921..733e22f12db 100644
--- a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Api/PetApi.cs
+++ b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Api/PetApi.cs
@@ -26,7 +26,7 @@
///
/// ID of pet that needs to be fetched
///
- public Pet getPetById (string petId) {
+ public Pet getPetById (long petId) {
// create path and map variables
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));
@@ -92,6 +92,111 @@
}
}
///
+ /// partial updates to a pet
+ ///
+ /// ID of pet that needs to be fetched
+ /// Pet object that needs to be added to the store
+ ///
+ public Array partialUpdate (string petId, Pet body) {
+ // create path and map variables
+ var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));
+
+ // query params
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+
+ // verify required params are set
+ if (petId == null || body == null ) {
+ throw new ApiException(400, "missing required params");
+ }
+ string paramStr = null;
+ try {
+ var response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams);
+ if(response != null){
+ return (Array) ApiInvoker.deserialize(response, typeof(Array));
+ }
+ else {
+ return null;
+ }
+ } catch (ApiException ex) {
+ if(ex.ErrorCode == 404) {
+ return null;
+ }
+ else {
+ throw ex;
+ }
+ }
+ }
+ ///
+ /// Updates a pet in the store with form data
+ ///
+ /// ID of pet that needs to be updated
+ /// Updated name of the pet
+ /// Updated status of the pet
+ ///
+ public void updatePetWithForm (string petId, string name, string status) {
+ // create path and map variables
+ var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));
+
+ // query params
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+
+ // verify required params are set
+ if (petId == null ) {
+ throw new ApiException(400, "missing required params");
+ }
+ string paramStr = null;
+ try {
+ var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams);
+ if(response != null){
+ return ;
+ }
+ else {
+ return ;
+ }
+ } catch (ApiException ex) {
+ if(ex.ErrorCode == 404) {
+ return ;
+ }
+ else {
+ throw ex;
+ }
+ }
+ }
+ ///
+ /// uploads an image
+ ///
+ /// Additional data to pass to server
+ /// file to upload
+ ///
+ public void uploadFile (string additionalMetadata, File body) {
+ // create path and map variables
+ var path = "/pet/uploadImage".Replace("{format}","json");
+
+ // query params
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+
+ string paramStr = null;
+ try {
+ var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
+ if(response != null){
+ return ;
+ }
+ else {
+ return ;
+ }
+ } catch (ApiException ex) {
+ if(ex.ErrorCode == 404) {
+ return ;
+ }
+ else {
+ throw ex;
+ }
+ }
+ }
+ ///
/// Add a new pet to the store
///
/// Pet object that needs to be added to the store
@@ -166,7 +271,7 @@
///
/// Status values that need to be considered for filter
///
- public List findPetsByStatus (string status) {
+ public Array findPetsByStatus (string status) {
// create path and map variables
var path = "/pet/findByStatus".Replace("{format}","json");
@@ -186,7 +291,7 @@
try {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
if(response != null){
- return (List) ApiInvoker.deserialize(response, typeof(List));
+ return (Array) ApiInvoker.deserialize(response, typeof(Array));
}
else {
return null;
@@ -205,7 +310,7 @@
///
/// Tags to filter by
///
- public List findPetsByTags (string tags) {
+ public Array findPetsByTags (string tags) {
// create path and map variables
var path = "/pet/findByTags".Replace("{format}","json");
@@ -225,7 +330,7 @@
try {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
if(response != null){
- return (List) ApiInvoker.deserialize(response, typeof(List));
+ return (Array) ApiInvoker.deserialize(response, typeof(Array));
}
else {
return null;
diff --git a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Api/UserApi.cs b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Api/UserApi.cs
index d94ce91baad..bde3ed4af4b 100644
--- a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Api/UserApi.cs
+++ b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Api/UserApi.cs
@@ -61,7 +61,7 @@
///
/// List of user object
///
- public void createUsersWithArrayInput (array body) {
+ public void createUsersWithArrayInput (List body) {
// create path and map variables
var path = "/user/createWithArray".Replace("{format}","json");
@@ -96,7 +96,7 @@
///
/// List of user object
///
- public void createUsersWithListInput (array body) {
+ public void createUsersWithListInput (List body) {
// create path and map variables
var path = "/user/createWithList".Replace("{format}","json");
diff --git a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Category.cs b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Category.cs
index 29dafc57737..e5aa324be6c 100644
--- a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Category.cs
+++ b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Category.cs
@@ -5,15 +5,17 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model {
public class Category {
- public string name { get; set; }
-
+ /* Category unique identifier */
public long id { get; set; }
+ /* Name of the category */
+ public string name { get; set; }
+
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Category {\n");
- sb.Append(" name: ").Append(name).Append("\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/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Order.cs b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Order.cs
index 72b65ad4206..d4d5a0d77a1 100644
--- a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Order.cs
+++ b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Order.cs
@@ -5,24 +5,28 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model {
public class Order {
+ /* Unique identifier for the order */
public long id { get; set; }
- /* Order Status */
- public string status { get; set; }
-
+ /* ID of pet being ordered */
public long petId { get; set; }
+ /* Number of pets ordered */
public int quantity { get; set; }
+ /* Status of the order */
+ public string status { get; set; }
+
+ /* Date shipped, only if it has been */
public DateTime shipDate { get; set; }
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Order {\n");
sb.Append(" id: ").Append(id).Append("\n");
- sb.Append(" status: ").Append(status).Append("\n");
sb.Append(" petId: ").Append(petId).Append("\n");
sb.Append(" quantity: ").Append(quantity).Append("\n");
+ sb.Append(" status: ").Append(status).Append("\n");
sb.Append(" shipDate: ").Append(shipDate).Append("\n");
sb.Append("}\n");
return sb.ToString();
diff --git a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Pet.cs b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Pet.cs
index 92acc0f980d..87bca18a1f4 100644
--- a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Pet.cs
+++ b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Pet.cs
@@ -5,28 +5,33 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model {
public class Pet {
- public string name { get; set; }
-
+ /* Unique identifier for the Pet */
public long id { get; set; }
+ /* Category the pet is in */
+ public Category category { get; set; }
+
+ /* Friendly name of the pet */
+ public string name { get; set; }
+
+ /* Image URLs */
+ public List photoUrls { get; set; }
+
+ /* Tags assigned to this pet */
public List tags { get; set; }
/* pet status in the store */
public string status { get; set; }
- public List photoUrls { get; set; }
-
- public Category category { get; set; }
-
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Pet {\n");
- sb.Append(" name: ").Append(name).Append("\n");
sb.Append(" id: ").Append(id).Append("\n");
+ sb.Append(" category: ").Append(category).Append("\n");
+ sb.Append(" name: ").Append(name).Append("\n");
+ sb.Append(" photoUrls: ").Append(photoUrls).Append("\n");
sb.Append(" tags: ").Append(tags).Append("\n");
sb.Append(" status: ").Append(status).Append("\n");
- sb.Append(" photoUrls: ").Append(photoUrls).Append("\n");
- sb.Append(" category: ").Append(category).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
diff --git a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Tag.cs b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Tag.cs
index 64daaa61c72..8a4b38b656b 100644
--- a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Tag.cs
+++ b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/Tag.cs
@@ -5,15 +5,17 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model {
public class Tag {
- public string name { get; set; }
-
+ /* Unique identifier for the tag */
public long id { get; set; }
+ /* Friendly name for the tag */
+ public string name { get; set; }
+
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Tag {\n");
- sb.Append(" name: ").Append(name).Append("\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/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/User.cs b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/User.cs
index bbbd6eaccc3..adce974f71f 100644
--- a/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/User.cs
+++ b/samples/client/petstore/csharp/src/Com/Wordnik/Petstore/Model/User.cs
@@ -5,18 +5,25 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model {
public class User {
+ /* Unique identifier for the user */
public long id { get; set; }
- public string firstName { get; set; }
-
+ /* Unique username */
public string username { get; set; }
+ /* First name of the user */
+ public string firstName { get; set; }
+
+ /* Last name of the user */
public string lastName { get; set; }
+ /* Email address of the user */
public string email { get; set; }
+ /* Password name of the user */
public string password { get; set; }
+ /* Phone number of the user */
public string phone { get; set; }
/* User Status */
@@ -26,8 +33,8 @@ namespace Com.Wordnik.Petstore.Model {
var sb = new StringBuilder();
sb.Append("class User {\n");
sb.Append(" id: ").Append(id).Append("\n");
- sb.Append(" firstName: ").Append(firstName).Append("\n");
sb.Append(" username: ").Append(username).Append("\n");
+ sb.Append(" firstName: ").Append(firstName).Append("\n");
sb.Append(" lastName: ").Append(lastName).Append("\n");
sb.Append(" email: ").Append(email).Append("\n");
sb.Append(" password: ").Append(password).Append("\n");
diff --git a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/PetApi.as b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/PetApi.as
index cc320ab96ff..6891d8456bc 100644
--- a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/PetApi.as
+++ b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/PetApi.as
@@ -7,6 +7,7 @@ import com.wordnik.swagger.common.ApiUserCredentials;
import com.wordnik.swagger.event.Response;
import com.wordnik.swagger.common.SwaggerApi;
import com.wordnik.client.model.Pet;
+import com.wordnik.client.model.File;
import mx.rpc.AsyncToken;
import mx.utils.UIDUtil;
import flash.utils.Dictionary;
@@ -23,15 +24,19 @@ public class PetApi extends SwaggerApi {
}
public static const event_getPetById: String = "getPetById";
+public static const event_deletePet: String = "deletePet";
+public static const event_partialUpdate: String = "partialUpdate";
+public static const event_updatePetWithForm: String = "updatePetWithForm";
+public static const event_uploadFile: String = "uploadFile";
public static const event_addPet: String = "addPet";
public static const event_updatePet: String = "updatePet";
public static const event_findPetsByStatus: String = "findPetsByStatus";
public static const event_findPetsByTags: String = "findPetsByTags";
/*
* Returns Pet */
- public function getPetById (petId: String): String {
+ public function getPetById (petId: Number): String {
// create path and map variables
- var path: String = "/pet.{format}/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
+ var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
// query params
var queryParams: Dictionary = new Dictionary();
@@ -51,12 +56,108 @@ public static const event_findPetsByTags: String = "findPetsByTags";
token.returnType = Pet;
return requestId;
+ }
+ /*
+ * Returns void */
+ public function deletePet (petId: String): String {
+ // create path and map variables
+ var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
+
+ // query params
+ var queryParams: Dictionary = new Dictionary();
+ var headerParams: Dictionary = new Dictionary();
+
+ // verify required params are set
+ if(petId == null ) {
+ throw new ApiError(400, "missing required params");
+ }
+ var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
+
+ var requestId: String = getUniqueId();
+
+ token.requestId = requestId;
+ token.completionEventType = "deletePet";
+
+ token.returnType = null ;
+ return requestId;
+
+ }
+ /*
+ * Returns Array[Pet] */
+ public function partialUpdate (petId: String, body: Pet): String {
+ // create path and map variables
+ var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
+
+ // query params
+ var queryParams: Dictionary = new Dictionary();
+ var headerParams: Dictionary = new Dictionary();
+
+ // verify required params are set
+ if(petId == null || body == null ) {
+ throw new ApiError(400, "missing required params");
+ }
+ var token:AsyncToken = getApiInvoker().invokeAPI(path, "PATCH", queryParams, body, headerParams);
+
+ var requestId: String = getUniqueId();
+
+ token.requestId = requestId;
+ token.completionEventType = "partialUpdate";
+
+ token.returnType = Array[Pet];
+ return requestId;
+
+ }
+ /*
+ * Returns void */
+ public function updatePetWithForm (petId: String, name: String, status: String): String {
+ // create path and map variables
+ var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
+
+ // query params
+ var queryParams: Dictionary = new Dictionary();
+ var headerParams: Dictionary = new Dictionary();
+
+ // verify required params are set
+ if(petId == null ) {
+ throw new ApiError(400, "missing required params");
+ }
+ var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams);
+
+ var requestId: String = getUniqueId();
+
+ token.requestId = requestId;
+ token.completionEventType = "updatePetWithForm";
+
+ token.returnType = null ;
+ return requestId;
+
+ }
+ /*
+ * Returns void */
+ public function uploadFile (additionalMetadata: String, body: File): String {
+ // create path and map variables
+ var path: String = "/pet/uploadImage".replace(/{format}/g,"xml");
+
+ // query params
+ var queryParams: Dictionary = new Dictionary();
+ var headerParams: Dictionary = new Dictionary();
+
+ var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
+
+ var requestId: String = getUniqueId();
+
+ token.requestId = requestId;
+ token.completionEventType = "uploadFile";
+
+ token.returnType = null ;
+ return requestId;
+
}
/*
* Returns void */
public function addPet (body: Pet): String {
// create path and map variables
- var path: String = "/pet.{format}".replace(/{format}/g,"xml");
+ var path: String = "/pet".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
@@ -81,7 +182,7 @@ public static const event_findPetsByTags: String = "findPetsByTags";
* Returns void */
public function updatePet (body: Pet): String {
// create path and map variables
- var path: String = "/pet.{format}".replace(/{format}/g,"xml");
+ var path: String = "/pet".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
@@ -103,10 +204,10 @@ public static const event_findPetsByTags: String = "findPetsByTags";
}
/*
- * Returns com.wordnik.client.model.PetList */
+ * Returns Array[Pet] */
public function findPetsByStatus (status: String= "available"): String {
// create path and map variables
- var path: String = "/pet.{format}/findByStatus".replace(/{format}/g,"xml");
+ var path: String = "/pet/findByStatus".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
@@ -125,15 +226,15 @@ public static const event_findPetsByTags: String = "findPetsByTags";
token.requestId = requestId;
token.completionEventType = "findPetsByStatus";
- token.returnType = com.wordnik.client.model.PetList;
+ token.returnType = Array[Pet];
return requestId;
}
/*
- * Returns com.wordnik.client.model.PetList */
+ * Returns Array[Pet] */
public function findPetsByTags (tags: String): String {
// create path and map variables
- var path: String = "/pet.{format}/findByTags".replace(/{format}/g,"xml");
+ var path: String = "/pet/findByTags".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
@@ -152,7 +253,7 @@ public static const event_findPetsByTags: String = "findPetsByTags";
token.requestId = requestId;
token.completionEventType = "findPetsByTags";
- token.returnType = com.wordnik.client.model.PetList;
+ token.returnType = Array[Pet];
return requestId;
}
diff --git a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/StoreApi.as b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/StoreApi.as
index 4ce2a47f0cc..4712d9ae997 100644
--- a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/StoreApi.as
+++ b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/StoreApi.as
@@ -29,7 +29,7 @@ public static const event_placeOrder: String = "placeOrder";
* Returns Order */
public function getOrderById (orderId: String): String {
// create path and map variables
- var path: String = "/store.{format}/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
+ var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
// query params
var queryParams: Dictionary = new Dictionary();
@@ -54,7 +54,7 @@ public static const event_placeOrder: String = "placeOrder";
* Returns void */
public function deleteOrder (orderId: String): String {
// create path and map variables
- var path: String = "/store.{format}/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
+ var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
// query params
var queryParams: Dictionary = new Dictionary();
@@ -79,7 +79,7 @@ public static const event_placeOrder: String = "placeOrder";
* Returns void */
public function placeOrder (body: Order): String {
// create path and map variables
- var path: String = "/store.{format}/order".replace(/{format}/g,"xml");
+ var path: String = "/store/order".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
diff --git a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/UserApi.as b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/UserApi.as
index 1464eca03c8..d502f6341bf 100644
--- a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/UserApi.as
+++ b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/api/UserApi.as
@@ -22,8 +22,8 @@ public class UserApi extends SwaggerApi {
super(apiCredentials, eventDispatcher);
}
-public static const event_createUsersWithArrayInput: String = "createUsersWithArrayInput";
public static const event_createUser: String = "createUser";
+public static const event_createUsersWithArrayInput: String = "createUsersWithArrayInput";
public static const event_createUsersWithListInput: String = "createUsersWithListInput";
public static const event_updateUser: String = "updateUser";
public static const event_deleteUser: String = "deleteUser";
@@ -32,34 +32,9 @@ public static const event_loginUser: String = "loginUser";
public static const event_logoutUser: String = "logoutUser";
/*
* Returns void */
- public function createUsersWithArrayInput (body: Array): String {
- // create path and map variables
- var path: String = "/user.{format}/createWithArray".replace(/{format}/g,"xml");
-
- // query params
- var queryParams: Dictionary = new Dictionary();
- var headerParams: Dictionary = new Dictionary();
-
- // verify required params are set
- if(body == null ) {
- throw new ApiError(400, "missing required params");
- }
- var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
-
- var requestId: String = getUniqueId();
-
- token.requestId = requestId;
- token.completionEventType = "createUsersWithArrayInput";
-
- token.returnType = null ;
- return requestId;
-
- }
- /*
- * Returns void */
public function createUser (body: User): String {
// create path and map variables
- var path: String = "/user.{format}".replace(/{format}/g,"xml");
+ var path: String = "/user".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
@@ -79,12 +54,37 @@ public static const event_logoutUser: String = "logoutUser";
token.returnType = null ;
return requestId;
+ }
+ /*
+ * Returns void */
+ public function createUsersWithArrayInput (body: Array): String {
+ // create path and map variables
+ var path: String = "/user/createWithArray".replace(/{format}/g,"xml");
+
+ // query params
+ var queryParams: Dictionary = new Dictionary();
+ var headerParams: Dictionary = new Dictionary();
+
+ // verify required params are set
+ if(body == null ) {
+ throw new ApiError(400, "missing required params");
+ }
+ var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
+
+ var requestId: String = getUniqueId();
+
+ token.requestId = requestId;
+ token.completionEventType = "createUsersWithArrayInput";
+
+ token.returnType = null ;
+ return requestId;
+
}
/*
* Returns void */
public function createUsersWithListInput (body: Array): String {
// create path and map variables
- var path: String = "/user.{format}/createWithList".replace(/{format}/g,"xml");
+ var path: String = "/user/createWithList".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
@@ -109,7 +109,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns void */
public function updateUser (username: String, body: User): String {
// create path and map variables
- var path: String = "/user.{format}/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
+ var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
// query params
var queryParams: Dictionary = new Dictionary();
@@ -134,7 +134,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns void */
public function deleteUser (username: String): String {
// create path and map variables
- var path: String = "/user.{format}/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
+ var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
// query params
var queryParams: Dictionary = new Dictionary();
@@ -159,7 +159,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns User */
public function getUserByName (username: String): String {
// create path and map variables
- var path: String = "/user.{format}/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
+ var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
// query params
var queryParams: Dictionary = new Dictionary();
@@ -184,7 +184,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns string */
public function loginUser (username: String, password: String): String {
// create path and map variables
- var path: String = "/user.{format}/login".replace(/{format}/g,"xml");
+ var path: String = "/user/login".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
@@ -213,7 +213,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns void */
public function logoutUser (): String {
// create path and map variables
- var path: String = "/user.{format}/logout".replace(/{format}/g,"xml");
+ var path: String = "/user/logout".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
diff --git a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Category.as b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Category.as
index 1b17bd5b332..945997f2fb4 100644
--- a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Category.as
+++ b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Category.as
@@ -2,9 +2,11 @@ package com.wordnik.client.model {
[XmlRootNode(name="Category")]
public class Category {
+ /* Category unique identifier */
[XmlElement(name="id")]
public var id: Number = 0.0;
+ /* Name of the category */
[XmlElement(name="name")]
public var name: String = null;
diff --git a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Order.as b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Order.as
index 6124e260f8f..d1842252d2f 100644
--- a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Order.as
+++ b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Order.as
@@ -2,19 +2,23 @@ package com.wordnik.client.model {
[XmlRootNode(name="Order")]
public class Order {
+ /* Unique identifier for the order */
[XmlElement(name="id")]
public var id: Number = 0.0;
+ /* ID of pet being ordered */
[XmlElement(name="petId")]
public var petId: Number = 0.0;
- /* Order Status */
- [XmlElement(name="status")]
- public var status: String = null;
-
+ /* Number of pets ordered */
[XmlElement(name="quantity")]
public var quantity: Number = 0.0;
+ /* Status of the order */
+ [XmlElement(name="status")]
+ public var status: String = null;
+
+ /* Date shipped, only if it has been */
[XmlElement(name="shipDate")]
public var shipDate: Date = null;
@@ -22,8 +26,8 @@ package com.wordnik.client.model {
var str: String = "Order: ";
str += " (id: " + id + ")";
str += " (petId: " + petId + ")";
- str += " (status: " + status + ")";
str += " (quantity: " + quantity + ")";
+ str += " (status: " + status + ")";
str += " (shipDate: " + shipDate + ")";
return str;
}
diff --git a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Pet.as b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Pet.as
index a804d8f63d7..cfab2c7f90f 100644
--- a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Pet.as
+++ b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Pet.as
@@ -4,39 +4,44 @@ import com.wordnik.client.model.Category;
import com.wordnik.client.model.Tag;
[XmlRootNode(name="Pet")]
public class Pet {
- // This declaration below of _tags_obj_class is to force flash compiler to include this class
- private var _tags_obj_class: com.wordnik.client.model.Tag = null;
- [XmlElementWrapper(name="tags")]
- [XmlElements(name="tag", type="com.wordnik.client.model.Tag")]
- public var tags: Array = new Array();
-
+ /* Unique identifier for the Pet */
[XmlElement(name="id")]
public var id: Number = 0.0;
+ /* Category the pet is in */
[XmlElement(name="category")]
public var category: Category = null;
- /* pet status in the store */
- [XmlElement(name="status")]
- public var status: String = null;
-
+ /* Friendly name of the pet */
[XmlElement(name="name")]
public var name: String = null;
+ /* Image URLs */
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
private var _photoUrls_obj_class: com.wordnik.client.model.String = null;
[XmlElementWrapper(name="photoUrls")]
[XmlElements(name="photoUrl", type="com.wordnik.client.model.String")]
public var photoUrls: Array = new Array();
+ /* Tags assigned to this pet */
+ // This declaration below of _tags_obj_class is to force flash compiler to include this class
+ private var _tags_obj_class: com.wordnik.client.model.Tag = null;
+ [XmlElementWrapper(name="tags")]
+ [XmlElements(name="tag", type="com.wordnik.client.model.Tag")]
+ public var tags: Array = new Array();
+
+ /* pet status in the store */
+ [XmlElement(name="status")]
+ public var status: String = null;
+
public function toString(): String {
var str: String = "Pet: ";
- str += " (tags: " + tags + ")";
str += " (id: " + id + ")";
str += " (category: " + category + ")";
- str += " (status: " + status + ")";
str += " (name: " + name + ")";
str += " (photoUrls: " + photoUrls + ")";
+ str += " (tags: " + tags + ")";
+ str += " (status: " + status + ")";
return str;
}
diff --git a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Tag.as b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Tag.as
index e229eb0ba64..93f77b50b2e 100644
--- a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Tag.as
+++ b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/Tag.as
@@ -2,9 +2,11 @@ package com.wordnik.client.model {
[XmlRootNode(name="Tag")]
public class Tag {
+ /* Unique identifier for the tag */
[XmlElement(name="id")]
public var id: Number = 0.0;
+ /* Friendly name for the tag */
[XmlElement(name="name")]
public var name: String = null;
diff --git a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/User.as b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/User.as
index 82a7b9d5bef..b5110b3cc5f 100644
--- a/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/User.as
+++ b/samples/client/petstore/flash/src/main/flex/com/wordnik/client/model/User.as
@@ -2,41 +2,48 @@ package com.wordnik.client.model {
[XmlRootNode(name="User")]
public class User {
+ /* Unique identifier for the user */
[XmlElement(name="id")]
public var id: Number = 0.0;
- [XmlElement(name="lastName")]
- public var lastName: String = null;
-
- [XmlElement(name="phone")]
- public var phone: String = null;
-
+ /* Unique username */
[XmlElement(name="username")]
public var username: String = null;
+ /* First name of the user */
+ [XmlElement(name="firstName")]
+ public var firstName: String = null;
+
+ /* Last name of the user */
+ [XmlElement(name="lastName")]
+ public var lastName: String = null;
+
+ /* Email address of the user */
[XmlElement(name="email")]
public var email: String = null;
+ /* Password name of the user */
+ [XmlElement(name="password")]
+ public var password: String = null;
+
+ /* Phone number of the user */
+ [XmlElement(name="phone")]
+ public var phone: String = null;
+
/* User Status */
[XmlElement(name="userStatus")]
public var userStatus: Number = 0.0;
- [XmlElement(name="firstName")]
- public var firstName: String = null;
-
- [XmlElement(name="password")]
- public var password: String = null;
-
public function toString(): String {
var str: String = "User: ";
str += " (id: " + id + ")";
- str += " (lastName: " + lastName + ")";
- str += " (phone: " + phone + ")";
str += " (username: " + username + ")";
- str += " (email: " + email + ")";
- str += " (userStatus: " + userStatus + ")";
str += " (firstName: " + firstName + ")";
+ str += " (lastName: " + lastName + ")";
+ str += " (email: " + email + ")";
str += " (password: " + password + ")";
+ str += " (phone: " + phone + ")";
+ str += " (userStatus: " + userStatus + ")";
return str;
}
diff --git a/samples/client/petstore/php/PetApi.php b/samples/client/petstore/php/PetApi.php
index de447aafaaa..94400f032b6 100644
--- a/samples/client/petstore/php/PetApi.php
+++ b/samples/client/petstore/php/PetApi.php
@@ -28,14 +28,14 @@ class PetApi {
/**
* getPetById
* Find pet by ID
- * petId, string: ID of pet that needs to be fetched (required)
+ * petId, int: ID of pet that needs to be fetched (required)
* @return Pet
*/
public function getPetById($petId) {
//parse inputs
- $resourcePath = "/pet.{format}/{petId}";
+ $resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
@@ -43,7 +43,7 @@ class PetApi {
if($petId != null) {
$resourcePath = str_replace("{" . "petId" . "}",
- $petId, $resourcePath);
+ $this->apiClient->toPathValue($petId), $resourcePath);
}
//make the API Call
if (! isset($body)) {
@@ -62,6 +62,134 @@ class PetApi {
'Pet');
return $responseObject;
+ }
+ /**
+ * deletePet
+ * Deletes a pet
+ * petId, string: Pet id to delete (required)
+ * @return
+ */
+
+ public function deletePet($petId) {
+
+ //parse inputs
+ $resourcePath = "/pet/{petId}";
+ $resourcePath = str_replace("{format}", "json", $resourcePath);
+ $method = "DELETE";
+ $queryParams = array();
+ $headerParams = array();
+
+ if($petId != null) {
+ $resourcePath = str_replace("{" . "petId" . "}",
+ $this->apiClient->toPathValue($petId), $resourcePath);
+ }
+ //make the API Call
+ if (! isset($body)) {
+ $body = null;
+ }
+ $response = $this->apiClient->callAPI($resourcePath, $method,
+ $queryParams, $body,
+ $headerParams);
+
+
+ }
+ /**
+ * partialUpdate
+ * partial updates to a pet
+ * petId, string: ID of pet that needs to be fetched (required)
+ * body, Pet: Pet object that needs to be added to the store (required)
+ * @return Array[Pet]
+ */
+
+ public function partialUpdate($petId, $body) {
+
+ //parse inputs
+ $resourcePath = "/pet/{petId}";
+ $resourcePath = str_replace("{format}", "json", $resourcePath);
+ $method = "PATCH";
+ $queryParams = array();
+ $headerParams = array();
+
+ if($petId != null) {
+ $resourcePath = str_replace("{" . "petId" . "}",
+ $this->apiClient->toPathValue($petId), $resourcePath);
+ }
+ //make the API Call
+ if (! isset($body)) {
+ $body = null;
+ }
+ $response = $this->apiClient->callAPI($resourcePath, $method,
+ $queryParams, $body,
+ $headerParams);
+
+
+ if(! $response){
+ return null;
+ }
+
+ $responseObject = $this->apiClient->deserialize($response,
+ 'Array[Pet]');
+ return $responseObject;
+
+ }
+ /**
+ * updatePetWithForm
+ * Updates a pet in the store with form data
+ * petId, string: ID of pet that needs to be updated (required)
+ * name, string: Updated name of the pet (optional)
+ * status, string: Updated status of the pet (optional)
+ * @return
+ */
+
+ public function updatePetWithForm($petId, $name=null, $status=null) {
+
+ //parse inputs
+ $resourcePath = "/pet/{petId}";
+ $resourcePath = str_replace("{format}", "json", $resourcePath);
+ $method = "POST";
+ $queryParams = array();
+ $headerParams = array();
+
+ if($petId != null) {
+ $resourcePath = str_replace("{" . "petId" . "}",
+ $this->apiClient->toPathValue($petId), $resourcePath);
+ }
+ //make the API Call
+ if (! isset($body)) {
+ $body = null;
+ }
+ $response = $this->apiClient->callAPI($resourcePath, $method,
+ $queryParams, $body,
+ $headerParams);
+
+
+ }
+ /**
+ * uploadFile
+ * uploads an image
+ * additionalMetadata, string: Additional data to pass to server (optional)
+ * body, File: file to upload (optional)
+ * @return
+ */
+
+ public function uploadFile($additionalMetadata=null, $body=null) {
+
+ //parse inputs
+ $resourcePath = "/pet/uploadImage";
+ $resourcePath = str_replace("{format}", "json", $resourcePath);
+ $method = "POST";
+ $queryParams = array();
+ $headerParams = array();
+
+ //make the API Call
+ if (! isset($body)) {
+ $body = null;
+ }
+ $response = $this->apiClient->callAPI($resourcePath, $method,
+ $queryParams, $body,
+ $headerParams);
+
+
}
/**
* addPet
@@ -73,7 +201,7 @@ class PetApi {
public function addPet($body) {
//parse inputs
- $resourcePath = "/pet.{format}";
+ $resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
@@ -99,7 +227,7 @@ class PetApi {
public function updatePet($body) {
//parse inputs
- $resourcePath = "/pet.{format}";
+ $resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT";
$queryParams = array();
@@ -119,20 +247,20 @@ class PetApi {
* findPetsByStatus
* Finds Pets by status
* status, string: Status values that need to be considered for filter (required)
- * @return array[Pet]
+ * @return Array[Pet]
*/
public function findPetsByStatus($status) {
//parse inputs
- $resourcePath = "/pet.{format}/findByStatus";
+ $resourcePath = "/pet/findByStatus";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
if($status != null) {
- $queryParams['status'] = $this->apiClient->toPathValue($status);
+ $queryParams['status'] = $this->apiClient->toQueryValue($status);
}
//make the API Call
if (! isset($body)) {
@@ -148,7 +276,7 @@ class PetApi {
}
$responseObject = $this->apiClient->deserialize($response,
- 'array[Pet]');
+ 'Array[Pet]');
return $responseObject;
}
@@ -156,20 +284,20 @@ class PetApi {
* findPetsByTags
* Finds Pets by tags
* tags, string: Tags to filter by (required)
- * @return array[Pet]
+ * @return Array[Pet]
*/
public function findPetsByTags($tags) {
//parse inputs
- $resourcePath = "/pet.{format}/findByTags";
+ $resourcePath = "/pet/findByTags";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
if($tags != null) {
- $queryParams['tags'] = $this->apiClient->toPathValue($tags);
+ $queryParams['tags'] = $this->apiClient->toQueryValue($tags);
}
//make the API Call
if (! isset($body)) {
@@ -185,7 +313,7 @@ class PetApi {
}
$responseObject = $this->apiClient->deserialize($response,
- 'array[Pet]');
+ 'Array[Pet]');
return $responseObject;
}
diff --git a/samples/client/petstore/php/StoreApi.php b/samples/client/petstore/php/StoreApi.php
index 50696eb5766..3ccabb3590c 100644
--- a/samples/client/petstore/php/StoreApi.php
+++ b/samples/client/petstore/php/StoreApi.php
@@ -35,7 +35,7 @@ class StoreApi {
public function getOrderById($orderId) {
//parse inputs
- $resourcePath = "/store.{format}/order/{orderId}";
+ $resourcePath = "/store/order/{orderId}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
@@ -43,7 +43,7 @@ class StoreApi {
if($orderId != null) {
$resourcePath = str_replace("{" . "orderId" . "}",
- $orderId, $resourcePath);
+ $this->apiClient->toPathValue($orderId), $resourcePath);
}
//make the API Call
if (! isset($body)) {
@@ -73,7 +73,7 @@ class StoreApi {
public function deleteOrder($orderId) {
//parse inputs
- $resourcePath = "/store.{format}/order/{orderId}";
+ $resourcePath = "/store/order/{orderId}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE";
$queryParams = array();
@@ -81,7 +81,7 @@ class StoreApi {
if($orderId != null) {
$resourcePath = str_replace("{" . "orderId" . "}",
- $orderId, $resourcePath);
+ $this->apiClient->toPathValue($orderId), $resourcePath);
}
//make the API Call
if (! isset($body)) {
@@ -103,7 +103,7 @@ class StoreApi {
public function placeOrder($body) {
//parse inputs
- $resourcePath = "/store.{format}/order";
+ $resourcePath = "/store/order";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
diff --git a/samples/client/petstore/php/Swagger.php b/samples/client/petstore/php/Swagger.php
index 473d47f968f..ddf7d79de63 100644
--- a/samples/client/petstore/php/Swagger.php
+++ b/samples/client/petstore/php/Swagger.php
@@ -67,7 +67,7 @@ class APIClient {
}
if (is_object($postData) or is_array($postData)) {
- $postData = json_encode($postData);
+ $postData = json_encode(self::sanitizeForSerialization($postData));
}
$url = $this->apiServer . $resourcePath;
@@ -118,18 +118,41 @@ class APIClient {
$response_info['http_code']);
}
+
return $data;
}
-
+ /**
+ * Build a JSON POST object
+ */
+ public static function sanitizeForSerialization($postData) {
+ foreach ($postData as $key => $value) {
+ if (is_a($value, "DateTime")) {
+ $postData->{$key} = $value->format(DateTime::ISO8601);
+ }
+ }
+ return $postData;
+ }
/**
* Take value and turn it into a string suitable for inclusion in
- * the path or the header
+ * the path, by url-encoding.
+ * @param string $value a string which will be part of the path
+ * @return string the serialized object
+ */
+ public static function toPathValue($value) {
+ return rawurlencode($value);
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the query, by imploding comma-separated if it's an object.
+ * If it's a string, pass through unchanged. It will be url-encoded
+ * later.
* @param object $object an object to be serialized to a string
* @return string the serialized object
*/
- public static function toPathValue($object) {
+ public static function toQueryValue($object) {
if (is_array($object)) {
return implode(',', $object);
} else {
@@ -137,9 +160,18 @@ class APIClient {
}
}
+ /**
+ * Just pass through the header value for now. Placeholder in case we
+ * find out we need to do something with header values.
+ * @param string $value a string which will be part of the header
+ * @return string the header string
+ */
+ public static function toHeaderValue($value) {
+ return $value;
+ }
/**
- * Derialize a JSON string into an object
+ * Deserialize a JSON string into an object
*
* @param object $object object or primitive to be deserialized
* @param string $class class name is passed as a string
@@ -177,17 +209,14 @@ class APIClient {
if (! property_exists($class, $true_property)) {
if (substr($property, -1) == 's') {
$true_property = substr($property, 0, -1);
- if (! property_exists($class, $true_property)) {
- trigger_error("class $class has no property $property"
- . " or $true_property", E_USER_WARNING);
- }
- } else {
- trigger_error("class $class has no property $property",
- E_USER_WARNING);
}
}
- $type = $classVars['swaggerTypes'][$true_property];
+ if (array_key_exists($true_property, $classVars['swaggerTypes'])) {
+ $type = $classVars['swaggerTypes'][$true_property];
+ } else {
+ $type = 'string';
+ }
if (in_array($type, array('string', 'int', 'float', 'bool'))) {
settype($value, $type);
$instance->{$true_property} = $value;
@@ -209,3 +238,5 @@ class APIClient {
?>
+
+
diff --git a/samples/client/petstore/php/UserApi.php b/samples/client/petstore/php/UserApi.php
index 92dc42259c2..49a4b55fd46 100644
--- a/samples/client/petstore/php/UserApi.php
+++ b/samples/client/petstore/php/UserApi.php
@@ -26,16 +26,16 @@ class UserApi {
}
/**
- * createUsersWithArrayInput
- * Creates list of users with given input array
- * body, array[User]: List of user object (required)
+ * createUser
+ * Create user
+ * body, User: Created user object (required)
* @return
*/
- public function createUsersWithArrayInput($body) {
+ public function createUser($body) {
//parse inputs
- $resourcePath = "/user.{format}/createWithArray";
+ $resourcePath = "/user";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
@@ -52,16 +52,16 @@ class UserApi {
}
/**
- * createUser
- * Create user
- * body, User: Created user object (required)
+ * createUsersWithArrayInput
+ * Creates list of users with given input array
+ * body, array[User]: List of user object (required)
* @return
*/
- public function createUser($body) {
+ public function createUsersWithArrayInput($body) {
//parse inputs
- $resourcePath = "/user.{format}";
+ $resourcePath = "/user/createWithArray";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
@@ -80,14 +80,14 @@ class UserApi {
/**
* createUsersWithListInput
* Creates list of users with given list input
- * body, List[User]: List of user object (required)
+ * body, array[User]: List of user object (required)
* @return
*/
public function createUsersWithListInput($body) {
//parse inputs
- $resourcePath = "/user.{format}/createWithList";
+ $resourcePath = "/user/createWithList";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
@@ -114,7 +114,7 @@ class UserApi {
public function updateUser($username, $body) {
//parse inputs
- $resourcePath = "/user.{format}/{username}";
+ $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT";
$queryParams = array();
@@ -122,7 +122,7 @@ class UserApi {
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
- $username, $resourcePath);
+ $this->apiClient->toPathValue($username), $resourcePath);
}
//make the API Call
if (! isset($body)) {
@@ -144,7 +144,7 @@ class UserApi {
public function deleteUser($username) {
//parse inputs
- $resourcePath = "/user.{format}/{username}";
+ $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE";
$queryParams = array();
@@ -152,7 +152,7 @@ class UserApi {
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
- $username, $resourcePath);
+ $this->apiClient->toPathValue($username), $resourcePath);
}
//make the API Call
if (! isset($body)) {
@@ -174,7 +174,7 @@ class UserApi {
public function getUserByName($username) {
//parse inputs
- $resourcePath = "/user.{format}/{username}";
+ $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
@@ -182,7 +182,7 @@ class UserApi {
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
- $username, $resourcePath);
+ $this->apiClient->toPathValue($username), $resourcePath);
}
//make the API Call
if (! isset($body)) {
@@ -213,17 +213,17 @@ class UserApi {
public function loginUser($username, $password) {
//parse inputs
- $resourcePath = "/user.{format}/login";
+ $resourcePath = "/user/login";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
if($username != null) {
- $queryParams['username'] = $this->apiClient->toPathValue($username);
+ $queryParams['username'] = $this->apiClient->toQueryValue($username);
}
if($password != null) {
- $queryParams['password'] = $this->apiClient->toPathValue($password);
+ $queryParams['password'] = $this->apiClient->toQueryValue($password);
}
//make the API Call
if (! isset($body)) {
@@ -252,7 +252,7 @@ class UserApi {
public function logoutUser() {
//parse inputs
- $resourcePath = "/user.{format}/logout";
+ $resourcePath = "/user/logout";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
diff --git a/samples/client/petstore/php/models/Category.php b/samples/client/petstore/php/models/Category.php
index adb99943fa3..ca8e3b0a7a4 100644
--- a/samples/client/petstore/php/models/Category.php
+++ b/samples/client/petstore/php/models/Category.php
@@ -29,7 +29,13 @@ class Category {
);
+ /**
+ * Category unique identifier
+ */
public $id; // int
+ /**
+ * Name of the category
+ */
public $name; // string
}
diff --git a/samples/client/petstore/php/models/Order.php b/samples/client/petstore/php/models/Order.php
index 71f45865f5f..645ce10e411 100644
--- a/samples/client/petstore/php/models/Order.php
+++ b/samples/client/petstore/php/models/Order.php
@@ -26,19 +26,31 @@ class Order {
static $swaggerTypes = array(
'id' => 'int',
'petId' => 'int',
- 'status' => 'string',
'quantity' => 'int',
+ 'status' => 'string',
'shipDate' => 'DateTime'
);
+ /**
+ * Unique identifier for the order
+ */
public $id; // int
+ /**
+ * ID of pet being ordered
+ */
public $petId; // int
/**
- * Order Status
+ * Number of pets ordered
+ */
+ public $quantity; // int
+ /**
+ * Status of the order
*/
public $status; // string
- public $quantity; // int
+ /**
+ * Date shipped, only if it has been
+ */
public $shipDate; // DateTime
}
diff --git a/samples/client/petstore/php/models/Pet.php b/samples/client/petstore/php/models/Pet.php
index fa5906c7483..aa711a7edf6 100644
--- a/samples/client/petstore/php/models/Pet.php
+++ b/samples/client/petstore/php/models/Pet.php
@@ -24,23 +24,38 @@
class Pet {
static $swaggerTypes = array(
- 'tags' => 'array[Some(Tag)]',
'id' => 'int',
'category' => 'Category',
- 'status' => 'string',
'name' => 'string',
- 'photoUrls' => 'array[None]'
+ 'photoUrls' => 'array[string]',
+ 'tags' => 'array[Tag]',
+ 'status' => 'string'
);
- public $tags; // array[Some(Tag)]
+ /**
+ * Unique identifier for the Pet
+ */
public $id; // int
+ /**
+ * Category the pet is in
+ */
public $category; // Category
/**
+ * Friendly name of the pet
+ */
+ public $name; // string
+ /**
+ * Image URLs
+ */
+ public $photoUrls; // array[string]
+ /**
+ * Tags assigned to this pet
+ */
+ public $tags; // array[Tag]
+ /**
* pet status in the store
*/
public $status; // string
- public $name; // string
- public $photoUrls; // array[None]
}
diff --git a/samples/client/petstore/php/models/Tag.php b/samples/client/petstore/php/models/Tag.php
index 8550685e45e..2d85e97b50b 100644
--- a/samples/client/petstore/php/models/Tag.php
+++ b/samples/client/petstore/php/models/Tag.php
@@ -29,7 +29,13 @@ class Tag {
);
+ /**
+ * Unique identifier for the tag
+ */
public $id; // int
+ /**
+ * Friendly name for the tag
+ */
public $name; // string
}
diff --git a/samples/client/petstore/php/models/User.php b/samples/client/petstore/php/models/User.php
index a07e11d68af..69c239082ee 100644
--- a/samples/client/petstore/php/models/User.php
+++ b/samples/client/petstore/php/models/User.php
@@ -25,26 +25,47 @@ class User {
static $swaggerTypes = array(
'id' => 'int',
- 'lastName' => 'string',
- 'phone' => 'string',
'username' => 'string',
- 'email' => 'string',
- 'userStatus' => 'int',
'firstName' => 'string',
- 'password' => 'string'
+ 'lastName' => 'string',
+ 'email' => 'string',
+ 'password' => 'string',
+ 'phone' => 'string',
+ 'userStatus' => 'int'
);
+ /**
+ * Unique identifier for the user
+ */
public $id; // int
- public $lastName; // string
- public $phone; // string
+ /**
+ * Unique username
+ */
public $username; // string
+ /**
+ * First name of the user
+ */
+ public $firstName; // string
+ /**
+ * Last name of the user
+ */
+ public $lastName; // string
+ /**
+ * Email address of the user
+ */
public $email; // string
/**
+ * Password name of the user
+ */
+ public $password; // string
+ /**
+ * Phone number of the user
+ */
+ public $phone; // string
+ /**
* User Status
*/
public $userStatus; // int
- public $firstName; // string
- public $password; // string
}
diff --git a/samples/client/petstore/python/PetApi.py b/samples/client/petstore/python/PetApi.py
index 1d999f69440..f544323f459 100644
--- a/samples/client/petstore/python/PetApi.py
+++ b/samples/client/petstore/python/PetApi.py
@@ -33,7 +33,7 @@ class PetApi(object):
"""Find pet by ID
Args:
- petId, str: ID of pet that needs to be fetched (required)
+ petId, long: ID of pet that needs to be fetched (required)
Returns: Pet
"""
@@ -47,7 +47,7 @@ class PetApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/pet.{format}/{petId}'
+ resourcePath = '/pet/{petId}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET'
@@ -70,6 +70,155 @@ class PetApi(object):
return responseObject
+ def deletePet(self, petId, **kwargs):
+ """Deletes a pet
+
+ Args:
+ petId, str: Pet id to delete (required)
+
+ Returns:
+ """
+
+ allParams = ['petId']
+
+ params = locals()
+ for (key, val) in params['kwargs'].iteritems():
+ if key not in allParams:
+ raise TypeError("Got an unexpected keyword argument '%s' to method deletePet" % key)
+ params[key] = val
+ del params['kwargs']
+
+ resourcePath = '/pet/{petId}'
+ resourcePath = resourcePath.replace('{format}', 'json')
+ method = 'DELETE'
+
+ queryParams = {}
+ headerParams = {}
+
+ if ('petId' in params):
+ replacement = str(self.apiClient.toPathValue(params['petId']))
+ resourcePath = resourcePath.replace('{' + 'petId' + '}',
+ replacement)
+ postData = (params['body'] if 'body' in params else None)
+
+ response = self.apiClient.callAPI(resourcePath, method, queryParams,
+ postData, headerParams)
+
+
+
+ def partialUpdate(self, petId, body, **kwargs):
+ """partial updates to a pet
+
+ Args:
+ petId, str: ID of pet that needs to be fetched (required)
+ body, Pet: Pet object that needs to be added to the store (required)
+
+ Returns: Array[Pet]
+ """
+
+ allParams = ['petId', 'body']
+
+ params = locals()
+ for (key, val) in params['kwargs'].iteritems():
+ if key not in allParams:
+ raise TypeError("Got an unexpected keyword argument '%s' to method partialUpdate" % key)
+ params[key] = val
+ del params['kwargs']
+
+ resourcePath = '/pet/{petId}'
+ resourcePath = resourcePath.replace('{format}', 'json')
+ method = 'PATCH'
+
+ queryParams = {}
+ headerParams = {}
+
+ if ('petId' in params):
+ replacement = str(self.apiClient.toPathValue(params['petId']))
+ resourcePath = resourcePath.replace('{' + 'petId' + '}',
+ replacement)
+ postData = (params['body'] if 'body' in params else None)
+
+ response = self.apiClient.callAPI(resourcePath, method, queryParams,
+ postData, headerParams)
+
+ if not response:
+ return None
+
+ responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
+ return responseObject
+
+
+ def updatePetWithForm(self, petId, **kwargs):
+ """Updates a pet in the store with form data
+
+ Args:
+ petId, str: ID of pet that needs to be updated (required)
+ name, str: Updated name of the pet (optional)
+ status, str: Updated status of the pet (optional)
+
+ Returns:
+ """
+
+ allParams = ['petId', 'name', 'status']
+
+ params = locals()
+ for (key, val) in params['kwargs'].iteritems():
+ if key not in allParams:
+ raise TypeError("Got an unexpected keyword argument '%s' to method updatePetWithForm" % key)
+ params[key] = val
+ del params['kwargs']
+
+ resourcePath = '/pet/{petId}'
+ resourcePath = resourcePath.replace('{format}', 'json')
+ method = 'POST'
+
+ queryParams = {}
+ headerParams = {}
+
+ if ('petId' in params):
+ replacement = str(self.apiClient.toPathValue(params['petId']))
+ resourcePath = resourcePath.replace('{' + 'petId' + '}',
+ replacement)
+ postData = (params['body'] if 'body' in params else None)
+
+ response = self.apiClient.callAPI(resourcePath, method, queryParams,
+ postData, headerParams)
+
+
+
+ def uploadFile(self, **kwargs):
+ """uploads an image
+
+ Args:
+ additionalMetadata, str: Additional data to pass to server (optional)
+ body, File: file to upload (optional)
+
+ Returns:
+ """
+
+ allParams = ['additionalMetadata', 'body']
+
+ params = locals()
+ for (key, val) in params['kwargs'].iteritems():
+ if key not in allParams:
+ raise TypeError("Got an unexpected keyword argument '%s' to method uploadFile" % key)
+ params[key] = val
+ del params['kwargs']
+
+ resourcePath = '/pet/uploadImage'
+ resourcePath = resourcePath.replace('{format}', 'json')
+ method = 'POST'
+
+ queryParams = {}
+ headerParams = {}
+
+ postData = (params['body'] if 'body' in params else None)
+
+ response = self.apiClient.callAPI(resourcePath, method, queryParams,
+ postData, headerParams)
+
+
+
def addPet(self, body, **kwargs):
"""Add a new pet to the store
@@ -88,7 +237,7 @@ class PetApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/pet.{format}'
+ resourcePath = '/pet'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST'
@@ -120,7 +269,7 @@ class PetApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/pet.{format}'
+ resourcePath = '/pet'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'PUT'
@@ -140,7 +289,7 @@ class PetApi(object):
Args:
status, str: Status values that need to be considered for filter (required)
- Returns: list[Pet]
+ Returns: Array[Pet]
"""
allParams = ['status']
@@ -152,7 +301,7 @@ class PetApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/pet.{format}/findByStatus'
+ resourcePath = '/pet/findByStatus'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET'
@@ -169,7 +318,7 @@ class PetApi(object):
if not response:
return None
- responseObject = self.apiClient.deserialize(response, 'list[Pet]')
+ responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
return responseObject
@@ -179,7 +328,7 @@ class PetApi(object):
Args:
tags, str: Tags to filter by (required)
- Returns: list[Pet]
+ Returns: Array[Pet]
"""
allParams = ['tags']
@@ -191,7 +340,7 @@ class PetApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/pet.{format}/findByTags'
+ resourcePath = '/pet/findByTags'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET'
@@ -208,7 +357,7 @@ class PetApi(object):
if not response:
return None
- responseObject = self.apiClient.deserialize(response, 'list[Pet]')
+ responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
return responseObject
diff --git a/samples/client/petstore/python/StoreApi.py b/samples/client/petstore/python/StoreApi.py
index 7529b731b06..68b8a9159e0 100644
--- a/samples/client/petstore/python/StoreApi.py
+++ b/samples/client/petstore/python/StoreApi.py
@@ -47,7 +47,7 @@ class StoreApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/store.{format}/order/{orderId}'
+ resourcePath = '/store/order/{orderId}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET'
@@ -88,7 +88,7 @@ class StoreApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/store.{format}/order/{orderId}'
+ resourcePath = '/store/order/{orderId}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'DELETE'
@@ -124,7 +124,7 @@ class StoreApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/store.{format}/order'
+ resourcePath = '/store/order'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST'
diff --git a/samples/client/petstore/python/UserApi.py b/samples/client/petstore/python/UserApi.py
index 25065076ef4..b02b9718617 100644
--- a/samples/client/petstore/python/UserApi.py
+++ b/samples/client/petstore/python/UserApi.py
@@ -29,38 +29,6 @@ class UserApi(object):
self.apiClient = apiClient
- def createUsersWithArrayInput(self, body, **kwargs):
- """Creates list of users with given input array
-
- Args:
- body, list[User]: List of user object (required)
-
- Returns:
- """
-
- allParams = ['body']
-
- params = locals()
- for (key, val) in params['kwargs'].iteritems():
- if key not in allParams:
- raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithArrayInput" % key)
- params[key] = val
- del params['kwargs']
-
- resourcePath = '/user.{format}/createWithArray'
- resourcePath = resourcePath.replace('{format}', 'json')
- method = 'POST'
-
- queryParams = {}
- headerParams = {}
-
- postData = (params['body'] if 'body' in params else None)
-
- response = self.apiClient.callAPI(resourcePath, method, queryParams,
- postData, headerParams)
-
-
-
def createUser(self, body, **kwargs):
"""Create user
@@ -79,7 +47,39 @@ class UserApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/user.{format}'
+ resourcePath = '/user'
+ resourcePath = resourcePath.replace('{format}', 'json')
+ method = 'POST'
+
+ queryParams = {}
+ headerParams = {}
+
+ postData = (params['body'] if 'body' in params else None)
+
+ response = self.apiClient.callAPI(resourcePath, method, queryParams,
+ postData, headerParams)
+
+
+
+ def createUsersWithArrayInput(self, body, **kwargs):
+ """Creates list of users with given input array
+
+ Args:
+ body, list[User]: List of user object (required)
+
+ Returns:
+ """
+
+ allParams = ['body']
+
+ params = locals()
+ for (key, val) in params['kwargs'].iteritems():
+ if key not in allParams:
+ raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithArrayInput" % key)
+ params[key] = val
+ del params['kwargs']
+
+ resourcePath = '/user/createWithArray'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST'
@@ -97,7 +97,7 @@ class UserApi(object):
"""Creates list of users with given list input
Args:
- body, List[User]: List of user object (required)
+ body, list[User]: List of user object (required)
Returns:
"""
@@ -111,7 +111,7 @@ class UserApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/user.{format}/createWithList'
+ resourcePath = '/user/createWithList'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST'
@@ -144,7 +144,7 @@ class UserApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/user.{format}/{username}'
+ resourcePath = '/user/{username}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'PUT'
@@ -180,7 +180,7 @@ class UserApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/user.{format}/{username}'
+ resourcePath = '/user/{username}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'DELETE'
@@ -216,7 +216,7 @@ class UserApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/user.{format}/{username}'
+ resourcePath = '/user/{username}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET'
@@ -258,7 +258,7 @@ class UserApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/user.{format}/login'
+ resourcePath = '/user/login'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET'
@@ -298,7 +298,7 @@ class UserApi(object):
params[key] = val
del params['kwargs']
- resourcePath = '/user.{format}/logout'
+ resourcePath = '/user/logout'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET'
diff --git a/samples/client/petstore/python/models/Category.py b/samples/client/petstore/python/models/Category.py
index 465f6034066..35b7fe08ad6 100644
--- a/samples/client/petstore/python/models/Category.py
+++ b/samples/client/petstore/python/models/Category.py
@@ -27,6 +27,8 @@ class Category:
}
+ #Category unique identifier
self.id = None # long
+ #Name of the category
self.name = None # str
diff --git a/samples/client/petstore/python/models/Order.py b/samples/client/petstore/python/models/Order.py
index 32b64ea5762..fc361a9f36b 100644
--- a/samples/client/petstore/python/models/Order.py
+++ b/samples/client/petstore/python/models/Order.py
@@ -23,17 +23,21 @@ class Order:
self.swaggerTypes = {
'id': 'long',
'petId': 'long',
- 'status': 'str',
'quantity': 'int',
+ 'status': 'str',
'shipDate': 'datetime'
}
+ #Unique identifier for the order
self.id = None # long
+ #ID of pet being ordered
self.petId = None # long
- #Order Status
- self.status = None # str
+ #Number of pets ordered
self.quantity = None # int
+ #Status of the order
+ self.status = None # str
+ #Date shipped, only if it has been
self.shipDate = None # datetime
diff --git a/samples/client/petstore/python/models/Pet.py b/samples/client/petstore/python/models/Pet.py
index 7eefc439515..e4559794263 100644
--- a/samples/client/petstore/python/models/Pet.py
+++ b/samples/client/petstore/python/models/Pet.py
@@ -21,21 +21,26 @@ class Pet:
def __init__(self):
self.swaggerTypes = {
- 'tags': 'list[Tag]',
'id': 'long',
'category': 'Category',
- 'status': 'str',
'name': 'str',
- 'photoUrls': 'list[str]'
+ 'photoUrls': 'list[str]',
+ 'tags': 'list[Tag]',
+ 'status': 'str'
}
- self.tags = None # list[Tag]
+ #Unique identifier for the Pet
self.id = None # long
+ #Category the pet is in
self.category = None # Category
+ #Friendly name of the pet
+ self.name = None # str
+ #Image URLs
+ self.photoUrls = None # list[str]
+ #Tags assigned to this pet
+ self.tags = None # list[Tag]
#pet status in the store
self.status = None # str
- self.name = None # str
- self.photoUrls = None # list[str]
diff --git a/samples/client/petstore/python/models/Tag.py b/samples/client/petstore/python/models/Tag.py
index 341f71c60ae..452f5b50ea3 100644
--- a/samples/client/petstore/python/models/Tag.py
+++ b/samples/client/petstore/python/models/Tag.py
@@ -27,6 +27,8 @@ class Tag:
}
+ #Unique identifier for the tag
self.id = None # long
+ #Friendly name for the tag
self.name = None # str
diff --git a/samples/client/petstore/python/models/User.py b/samples/client/petstore/python/models/User.py
index d68a5ccde9a..80f3a1e6f53 100644
--- a/samples/client/petstore/python/models/User.py
+++ b/samples/client/petstore/python/models/User.py
@@ -22,24 +22,31 @@ class User:
def __init__(self):
self.swaggerTypes = {
'id': 'long',
- 'lastName': 'str',
- 'phone': 'str',
'username': 'str',
- 'email': 'str',
- 'userStatus': 'int',
'firstName': 'str',
- 'password': 'str'
+ 'lastName': 'str',
+ 'email': 'str',
+ 'password': 'str',
+ 'phone': 'str',
+ 'userStatus': 'int'
}
+ #Unique identifier for the user
self.id = None # long
- self.lastName = None # str
- self.phone = None # str
+ #Unique username
self.username = None # str
+ #First name of the user
+ self.firstName = None # str
+ #Last name of the user
+ self.lastName = None # str
+ #Email address of the user
self.email = None # str
+ #Password name of the user
+ self.password = None # str
+ #Phone number of the user
+ self.phone = None # str
#User Status
self.userStatus = None # int
- self.firstName = None # str
- self.password = None # str
diff --git a/samples/client/petstore/python/swagger.py b/samples/client/petstore/python/swagger.py
index ef3d5f9a44a..98ed6250e02 100644
--- a/samples/client/petstore/python/swagger.py
+++ b/samples/client/petstore/python/swagger.py
@@ -36,7 +36,7 @@ class ApiClient:
for param, value in headerParams.iteritems():
headers[param] = value
- headers['Content-type'] = 'application/json'
+ #headers['Content-type'] = 'application/json'
headers['api_key'] = self.apiKey
if self.cookie:
@@ -44,15 +44,18 @@ class ApiClient:
data = None
- if method == 'GET':
+ if queryParams:
+ # Need to remove None values, these should not be sent
+ sentQueryParams = {}
+ for param, value in queryParams.items():
+ if value != None:
+ sentQueryParams[param] = value
+ url = url + '?' + urllib.urlencode(sentQueryParams)
- if queryParams:
- # Need to remove None values, these should not be sent
- sentQueryParams = {}
- for param, value in queryParams.items():
- if value != None:
- sentQueryParams[param] = value
- url = url + '?' + urllib.urlencode(sentQueryParams)
+ if method in ['GET']:
+
+ #Options to add statements later on and for compatibility
+ pass
elif method in ['POST', 'PUT', 'DELETE']:
@@ -81,21 +84,21 @@ class ApiClient:
return data
def toPathValue(self, obj):
- """Serialize a list to a CSV string, if necessary.
+ """Convert a string or object to a path-friendly value
Args:
- obj -- data object to be serialized
+ obj -- object or string value
Returns:
- string -- json serialization of object
+ string -- quoted value
"""
if type(obj) == list:
- return ','.join(obj)
+ return urllib.quote(','.join(obj))
else:
- return obj
+ return urllib.quote(str(obj))
def sanitizeForSerialization(self, obj):
"""Dump an object into JSON for POSTing."""
- if not obj:
+ if type(obj) == type(None):
return None
elif type(obj) in [str, int, long, float, bool]:
return obj
@@ -139,12 +142,12 @@ class ApiClient:
subClass = match.group(1)
return [self.deserialize(subObj, subClass) for subObj in obj]
- if (objClass in ['int', 'float', 'long', 'dict', 'list', 'str']):
+ if (objClass in ['int', 'float', 'long', 'dict', 'list', 'str', 'bool', 'datetime']):
objClass = eval(objClass)
else: # not a native type, must be model class
objClass = eval(objClass + '.' + objClass)
- if objClass in [str, int, long, float, bool]:
+ if objClass in [int, long, float, dict, list, str, bool]:
return objClass(obj)
elif objClass == datetime:
# Server will always return a time stamp in UTC, but with
@@ -164,7 +167,12 @@ class ApiClient:
value = attrType(value)
except UnicodeEncodeError:
value = unicode(value)
+ except TypeError:
+ value = value
setattr(instance, attr, value)
+ elif (attrType == 'datetime'):
+ setattr(instance, attr, datetime.datetime.strptime(value[:-5],
+ "%Y-%m-%dT%H:%M:%S.%f"))
elif 'list[' in attrType:
match = re.match('list\[(.*)\]', attrType)
subClass = match.group(1)
@@ -198,3 +206,4 @@ class MethodRequest(urllib2.Request):
def get_method(self):
return getattr(self, 'method', urllib2.Request.get_method(self))
+
diff --git a/samples/client/petstore/ruby/lib/Pet_api.rb b/samples/client/petstore/ruby/lib/Pet_api.rb
index 2cb00a1f7f6..51774c9abef 100644
--- a/samples/client/petstore/ruby/lib/Pet_api.rb
+++ b/samples/client/petstore/ruby/lib/Pet_api.rb
@@ -14,10 +14,11 @@ class Pet_api
# verify existence of params
raise "pet_id is required" if pet_id.nil?
# set default values and merge with input
- options = { :pet_id => pet_id}.merge(opts)
+ options = {
+ :pet_id => pet_id}.merge(opts)
#resource path
- path = "/pet.{format}/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
+ path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
# pull querystring keys from options
@@ -31,16 +32,155 @@ class Pet_api
Pet.new(response)
end
+def self.delete_pet (pet_id,opts={})
+ query_param_keys = []
+
+ # verify existence of params
+ raise "pet_id is required" if pet_id.nil?
+ # set default values and merge with input
+ options = {
+ :pet_id => pet_id}.merge(opts)
+
+ #resource path
+ path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = nil
+ post_body = nil
+ Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>headers, :body=>post_body}).make
+
+ end
+
+def self.partial_update (pet_id,body,opts={})
+ query_param_keys = []
+
+ # verify existence of params
+ raise "pet_id is required" if pet_id.nil?
+ raise "body is required" if body.nil?
+ # set default values and merge with input
+ options = {
+ :pet_id => pet_id,
+ :body => body}.merge(opts)
+
+ #resource path
+ path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = nil
+ post_body = nil
+ if body != nil
+ if body.is_a?(Array)
+ array = Array.new
+ body.each do |item|
+ if item.respond_to?("to_body".to_sym)
+ array.push item.to_body
+ else
+ array.push item
+ end
+ end
+ post_body = array
+
+ else
+ if body.respond_to?("to_body".to_sym)
+ post_body = body.to_body
+ else
+ post_body = body
+ end
+ end
+ end
+ response = Swagger::Request.new(:PATCH, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
+ response.map {|response|Pet.new(response)}
+ end
+
+def self.update_pet_with_form (pet_id,name,status,opts={})
+ query_param_keys = []
+
+ # verify existence of params
+ raise "pet_id is required" if pet_id.nil?
+ # set default values and merge with input
+ options = {
+ :pet_id => pet_id,
+ :name => name,
+ :status => status}.merge(opts)
+
+ #resource path
+ path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
+
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = nil
+ post_body = nil
+ Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body}).make
+
+ end
+
+def self.upload_file (additional_metadata,body,opts={})
+ query_param_keys = []
+
+ # set default values and merge with input
+ options = {
+ :additional_metadata => additional_metadata,
+ :body => body}.merge(opts)
+
+ #resource path
+ path = "/pet/uploadImage".sub('{format}','json')
+
+ # pull querystring keys from options
+ queryopts = options.select do |key,value|
+ query_param_keys.include? key
+ end
+
+ headers = nil
+ post_body = nil
+ if body != nil
+ if body.is_a?(Array)
+ array = Array.new
+ body.each do |item|
+ if item.respond_to?("to_body".to_sym)
+ array.push item.to_body
+ else
+ array.push item
+ end
+ end
+ post_body = array
+
+ else
+ if body.respond_to?("to_body".to_sym)
+ post_body = body.to_body
+ else
+ post_body = body
+ end
+ end
+ end
+ Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body}).make
+
+ end
+
def self.add_pet (body,opts={})
query_param_keys = []
# verify existence of params
raise "body is required" if body.nil?
# set default values and merge with input
- options = { :body => body}.merge(opts)
+ options = {
+ :body => body}.merge(opts)
#resource path
- path = "/pet.{format}".sub('{format}','json')
+ path = "/pet".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
@@ -79,10 +219,11 @@ def self.update_pet (body,opts={})
# verify existence of params
raise "body is required" if body.nil?
# set default values and merge with input
- options = { :body => body}.merge(opts)
+ options = {
+ :body => body}.merge(opts)
#resource path
- path = "/pet.{format}".sub('{format}','json')
+ path = "/pet".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
@@ -121,10 +262,11 @@ def self.find_pets_by_status (status= "available",opts={})
# verify existence of params
raise "status is required" if status.nil?
# set default values and merge with input
- options = { :status => status}.merge(opts)
+ options = {
+ :status => status}.merge(opts)
#resource path
- path = "/pet.{format}/findByStatus".sub('{format}','json')
+ path = "/pet/findByStatus".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
@@ -143,10 +285,11 @@ def self.find_pets_by_tags (tags,opts={})
# verify existence of params
raise "tags is required" if tags.nil?
# set default values and merge with input
- options = { :tags => tags}.merge(opts)
+ options = {
+ :tags => tags}.merge(opts)
#resource path
- path = "/pet.{format}/findByTags".sub('{format}','json')
+ path = "/pet/findByTags".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
diff --git a/samples/client/petstore/ruby/lib/Store_api.rb b/samples/client/petstore/ruby/lib/Store_api.rb
index 2469dd12c95..d2bd259bd65 100644
--- a/samples/client/petstore/ruby/lib/Store_api.rb
+++ b/samples/client/petstore/ruby/lib/Store_api.rb
@@ -14,10 +14,11 @@ class Store_api
# verify existence of params
raise "order_id is required" if order_id.nil?
# set default values and merge with input
- options = { :order_id => order_id}.merge(opts)
+ options = {
+ :order_id => order_id}.merge(opts)
#resource path
- path = "/store.{format}/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', escapeString(order_id))
+ path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', escapeString(order_id))
# pull querystring keys from options
@@ -37,10 +38,11 @@ def self.delete_order (order_id,opts={})
# verify existence of params
raise "order_id is required" if order_id.nil?
# set default values and merge with input
- options = { :order_id => order_id}.merge(opts)
+ options = {
+ :order_id => order_id}.merge(opts)
#resource path
- path = "/store.{format}/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', escapeString(order_id))
+ path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', escapeString(order_id))
# pull querystring keys from options
@@ -60,10 +62,11 @@ def self.place_order (body,opts={})
# verify existence of params
raise "body is required" if body.nil?
# set default values and merge with input
- options = { :body => body}.merge(opts)
+ options = {
+ :body => body}.merge(opts)
#resource path
- path = "/store.{format}/order".sub('{format}','json')
+ path = "/store/order".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
diff --git a/samples/client/petstore/ruby/lib/User_api.rb b/samples/client/petstore/ruby/lib/User_api.rb
index de73d035eeb..1ba377b22c4 100644
--- a/samples/client/petstore/ruby/lib/User_api.rb
+++ b/samples/client/petstore/ruby/lib/User_api.rb
@@ -8,16 +8,17 @@ class User_api
URI.encode(string.to_s)
end
- def self.create_users_with_array_input (body,opts={})
+ def self.create_user (body,opts={})
query_param_keys = []
# verify existence of params
raise "body is required" if body.nil?
# set default values and merge with input
- options = { :body => body}.merge(opts)
+ options = {
+ :body => body}.merge(opts)
#resource path
- path = "/user.{format}/createWithArray".sub('{format}','json')
+ path = "/user".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
@@ -50,16 +51,17 @@ class User_api
end
-def self.create_user (body,opts={})
+def self.create_users_with_array_input (body,opts={})
query_param_keys = []
# verify existence of params
raise "body is required" if body.nil?
# set default values and merge with input
- options = { :body => body}.merge(opts)
+ options = {
+ :body => body}.merge(opts)
#resource path
- path = "/user.{format}".sub('{format}','json')
+ path = "/user/createWithArray".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
@@ -98,10 +100,11 @@ def self.create_users_with_list_input (body,opts={})
# verify existence of params
raise "body is required" if body.nil?
# set default values and merge with input
- options = { :body => body}.merge(opts)
+ options = {
+ :body => body}.merge(opts)
#resource path
- path = "/user.{format}/createWithList".sub('{format}','json')
+ path = "/user/createWithList".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
@@ -141,10 +144,12 @@ def self.update_user (username,body,opts={})
raise "username is required" if username.nil?
raise "body is required" if body.nil?
# set default values and merge with input
- options = { :username => username, :body => body}.merge(opts)
+ options = {
+ :username => username,
+ :body => body}.merge(opts)
#resource path
- path = "/user.{format}/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
+ path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
# pull querystring keys from options
@@ -184,10 +189,11 @@ def self.delete_user (username,opts={})
# verify existence of params
raise "username is required" if username.nil?
# set default values and merge with input
- options = { :username => username}.merge(opts)
+ options = {
+ :username => username}.merge(opts)
#resource path
- path = "/user.{format}/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
+ path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
# pull querystring keys from options
@@ -207,10 +213,11 @@ def self.get_user_by_name (username,opts={})
# verify existence of params
raise "username is required" if username.nil?
# set default values and merge with input
- options = { :username => username}.merge(opts)
+ options = {
+ :username => username}.merge(opts)
#resource path
- path = "/user.{format}/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
+ path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
# pull querystring keys from options
@@ -231,10 +238,12 @@ def self.login_user (username,password,opts={})
raise "username is required" if username.nil?
raise "password is required" if password.nil?
# set default values and merge with input
- options = { :username => username, :password => password}.merge(opts)
+ options = {
+ :username => username,
+ :password => password}.merge(opts)
#resource path
- path = "/user.{format}/login".sub('{format}','json')
+ path = "/user/login".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
@@ -251,10 +260,11 @@ def self.logout_user (opts={})
query_param_keys = []
# set default values and merge with input
- options = { }.merge(opts)
+ options = {
+ }.merge(opts)
#resource path
- path = "/user.{format}/logout".sub('{format}','json')
+ path = "/user/logout".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
diff --git a/samples/client/petstore/ruby/lib/swagger/configuration.rb b/samples/client/petstore/ruby/lib/swagger/configuration.rb
index 137abd1bdfe..c3d127b1569 100644
--- a/samples/client/petstore/ruby/lib/swagger/configuration.rb
+++ b/samples/client/petstore/ruby/lib/swagger/configuration.rb
@@ -3,7 +3,8 @@ module Swagger
class Configuration
require 'swagger/version'
- attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger
+ attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path,
+ :user_agent, :logger, :inject_format
# Defaults go in here..
def initialize
@@ -12,8 +13,10 @@ module Swagger
@host = 'api.wordnik.com'
@base_path = '/v4'
@user_agent = "ruby-#{Swagger::VERSION}"
+ @inject_format = true
end
end
end
+
diff --git a/samples/client/petstore/ruby/lib/swagger/request.rb b/samples/client/petstore/ruby/lib/swagger/request.rb
index 93a8ddead2f..a5ab62fc484 100644
--- a/samples/client/petstore/ruby/lib/swagger/request.rb
+++ b/samples/client/petstore/ruby/lib/swagger/request.rb
@@ -81,8 +81,10 @@ module Swagger
# Stick a .{format} placeholder into the path if there isn't
# one already or an actual format like json or xml
# e.g. /words/blah => /words.{format}/blah
- unless ['.json', '.xml', '{format}'].any? {|s| p.downcase.include? s }
- p = p.sub(/^(\/?\w+)/, "\\1.#{format}")
+ if Swagger.configuration.inject_format
+ unless ['.json', '.xml', '{format}'].any? {|s| p.downcase.include? s }
+ p = p.sub(/^(\/?\w+)/, "\\1.#{format}")
+ end
end
p = p.sub("{format}", self.format.to_s)
@@ -184,3 +186,4 @@ module Swagger
end
end
+
diff --git a/samples/client/petstore/ruby/models/Category.rb b/samples/client/petstore/ruby/models/Category.rb
index c77144950f5..54bd6a5245b 100644
--- a/samples/client/petstore/ruby/models/Category.rb
+++ b/samples/client/petstore/ruby/models/Category.rb
@@ -3,32 +3,29 @@ class Category
# :internal => :external
def self.attribute_map
- {
- :id => :id, :name => :name
+ {
+ :id => :id,
+ :name => :name
- }
+ }
end
def initialize(attributes = {})
+ return if attributes.empty?
# Morph attribute keys into undescored rubyish style
- if attributes.to_s != ""
+ if self.class.attribute_map[:"id"]
+ @id = attributes["id"]
+ end
+ if self.class.attribute_map[:"name"]
+ @name = attributes["name"]
+ end
+
- if Category.attribute_map["id".to_sym] != nil
- name = "id".to_sym
- value = attributes["id"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Category.attribute_map["name".to_sym] != nil
- name = "name".to_sym
- value = attributes["name"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- end
end
def to_body
body = {}
- Category.attribute_map.each_pair do |key,value|
+ self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil?
end
body
diff --git a/samples/client/petstore/ruby/models/Order.rb b/samples/client/petstore/ruby/models/Order.rb
index 4bc865e31db..81bc6d5a4dc 100644
--- a/samples/client/petstore/ruby/models/Order.rb
+++ b/samples/client/petstore/ruby/models/Order.rb
@@ -1,49 +1,43 @@
class Order
- attr_accessor :id, :pet_id, :status, :quantity, :ship_date
+ attr_accessor :id, :pet_id, :quantity, :status, :ship_date
# :internal => :external
def self.attribute_map
- {
- :id => :id, :pet_id => :petId, :status => :status, :quantity => :quantity, :ship_date => :shipDate
+ {
+ :id => :id,
+ :pet_id => :petId,
+ :quantity => :quantity,
+ :status => :status,
+ :ship_date => :shipDate
- }
+ }
end
def initialize(attributes = {})
+ return if attributes.empty?
# Morph attribute keys into undescored rubyish style
- if attributes.to_s != ""
+ if self.class.attribute_map[:"id"]
+ @id = attributes["id"]
+ end
+ if self.class.attribute_map[:"pet_id"]
+ @pet_id = attributes["petId"]
+ end
+ if self.class.attribute_map[:"quantity"]
+ @quantity = attributes["quantity"]
+ end
+ if self.class.attribute_map[:"status"]
+ @status = attributes["status"]
+ end
+ if self.class.attribute_map[:"ship_date"]
+ @ship_date = attributes["shipDate"]
+ end
+
- if Order.attribute_map["id".to_sym] != nil
- name = "id".to_sym
- value = attributes["id"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Order.attribute_map["pet_id".to_sym] != nil
- name = "pet_id".to_sym
- value = attributes["petId"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Order.attribute_map["status".to_sym] != nil
- name = "status".to_sym
- value = attributes["status"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Order.attribute_map["quantity".to_sym] != nil
- name = "quantity".to_sym
- value = attributes["quantity"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Order.attribute_map["ship_date".to_sym] != nil
- name = "ship_date".to_sym
- value = attributes["shipDate"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- end
end
def to_body
body = {}
- Order.attribute_map.each_pair do |key,value|
+ self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil?
end
body
diff --git a/samples/client/petstore/ruby/models/Pet.rb b/samples/client/petstore/ruby/models/Pet.rb
index 26c32b785fe..f4b3eb2e4c8 100644
--- a/samples/client/petstore/ruby/models/Pet.rb
+++ b/samples/client/petstore/ruby/models/Pet.rb
@@ -1,66 +1,49 @@
class Pet
- attr_accessor :tags, :id, :category, :status, :name, :photo_urls
+ attr_accessor :id, :category, :name, :photo_urls, :tags, :status
# :internal => :external
def self.attribute_map
- {
- :tags => :tags, :id => :id, :category => :category, :status => :status, :name => :name, :photo_urls => :photoUrls
+ {
+ :id => :id,
+ :category => :category,
+ :name => :name,
+ :photo_urls => :photoUrls,
+ :tags => :tags,
+ :status => :status
- }
+ }
end
def initialize(attributes = {})
+ return if attributes.empty?
# Morph attribute keys into undescored rubyish style
- if attributes.to_s != ""
-
- if Pet.attribute_map["tags".to_sym] != nil
- name = "tags".to_sym
- value = attributes["tags"]
- if value.is_a?(Array)
- array = Array.new
- value.each do |arrayValue|
- array.push Tag.new(arrayValue)
- end
- send("#{name}=", array) if self.respond_to?(name)
- end
- end
- if Pet.attribute_map["id".to_sym] != nil
- name = "id".to_sym
- value = attributes["id"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Pet.attribute_map["category".to_sym] != nil
- name = "category".to_sym
- value = attributes["category"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Pet.attribute_map["status".to_sym] != nil
- name = "status".to_sym
- value = attributes["status"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Pet.attribute_map["name".to_sym] != nil
- name = "name".to_sym
- value = attributes["name"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Pet.attribute_map["photo_urls".to_sym] != nil
- name = "photo_urls".to_sym
- value = attributes["photoUrls"]
- if value.is_a?(Array)
- array = Array.new
- value.each do |arrayValue|
- array.push arrayValue
- end
- send("#{name}=", array) if self.respond_to?(name)
- end
- end
+ if self.class.attribute_map[:"id"]
+ @id = attributes["id"]
+ end
+ if self.class.attribute_map[:"category"]
+ @category = attributes["category"]
+ end
+ if self.class.attribute_map[:"name"]
+ @name = attributes["name"]
+ end
+ if self.class.attribute_map[:"photo_urls"]
+ if (value = attributes["photoUrls"]).is_a?(Array)
+ @photo_urls = valueend
end
+ if self.class.attribute_map[:"tags"]
+ if (value = attributes["tags"]).is_a?(Array)
+ @tags = value.map{ |v| Tag.new(v) }end
+ end
+ if self.class.attribute_map[:"status"]
+ @status = attributes["status"]
+ end
+
+
end
def to_body
body = {}
- Pet.attribute_map.each_pair do |key,value|
+ self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil?
end
body
diff --git a/samples/client/petstore/ruby/models/Tag.rb b/samples/client/petstore/ruby/models/Tag.rb
index 5360a29f23d..abe4929a3d1 100644
--- a/samples/client/petstore/ruby/models/Tag.rb
+++ b/samples/client/petstore/ruby/models/Tag.rb
@@ -3,32 +3,29 @@ class Tag
# :internal => :external
def self.attribute_map
- {
- :id => :id, :name => :name
+ {
+ :id => :id,
+ :name => :name
- }
+ }
end
def initialize(attributes = {})
+ return if attributes.empty?
# Morph attribute keys into undescored rubyish style
- if attributes.to_s != ""
+ if self.class.attribute_map[:"id"]
+ @id = attributes["id"]
+ end
+ if self.class.attribute_map[:"name"]
+ @name = attributes["name"]
+ end
+
- if Tag.attribute_map["id".to_sym] != nil
- name = "id".to_sym
- value = attributes["id"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if Tag.attribute_map["name".to_sym] != nil
- name = "name".to_sym
- value = attributes["name"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- end
end
def to_body
body = {}
- Tag.attribute_map.each_pair do |key,value|
+ self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil?
end
body
diff --git a/samples/client/petstore/ruby/models/User.rb b/samples/client/petstore/ruby/models/User.rb
index 9c0b83d6a21..ab01d21bfaf 100644
--- a/samples/client/petstore/ruby/models/User.rb
+++ b/samples/client/petstore/ruby/models/User.rb
@@ -1,64 +1,55 @@
class User
- attr_accessor :id, :last_name, :phone, :username, :email, :user_status, :first_name, :password
+ attr_accessor :id, :username, :first_name, :last_name, :email, :password, :phone, :user_status
# :internal => :external
def self.attribute_map
- {
- :id => :id, :last_name => :lastName, :phone => :phone, :username => :username, :email => :email, :user_status => :userStatus, :first_name => :firstName, :password => :password
+ {
+ :id => :id,
+ :username => :username,
+ :first_name => :firstName,
+ :last_name => :lastName,
+ :email => :email,
+ :password => :password,
+ :phone => :phone,
+ :user_status => :userStatus
- }
+ }
end
def initialize(attributes = {})
+ return if attributes.empty?
# Morph attribute keys into undescored rubyish style
- if attributes.to_s != ""
+ if self.class.attribute_map[:"id"]
+ @id = attributes["id"]
+ end
+ if self.class.attribute_map[:"username"]
+ @username = attributes["username"]
+ end
+ if self.class.attribute_map[:"first_name"]
+ @first_name = attributes["firstName"]
+ end
+ if self.class.attribute_map[:"last_name"]
+ @last_name = attributes["lastName"]
+ end
+ if self.class.attribute_map[:"email"]
+ @email = attributes["email"]
+ end
+ if self.class.attribute_map[:"password"]
+ @password = attributes["password"]
+ end
+ if self.class.attribute_map[:"phone"]
+ @phone = attributes["phone"]
+ end
+ if self.class.attribute_map[:"user_status"]
+ @user_status = attributes["userStatus"]
+ end
+
- if User.attribute_map["id".to_sym] != nil
- name = "id".to_sym
- value = attributes["id"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if User.attribute_map["last_name".to_sym] != nil
- name = "last_name".to_sym
- value = attributes["lastName"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if User.attribute_map["phone".to_sym] != nil
- name = "phone".to_sym
- value = attributes["phone"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if User.attribute_map["username".to_sym] != nil
- name = "username".to_sym
- value = attributes["username"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if User.attribute_map["email".to_sym] != nil
- name = "email".to_sym
- value = attributes["email"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if User.attribute_map["user_status".to_sym] != nil
- name = "user_status".to_sym
- value = attributes["userStatus"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if User.attribute_map["first_name".to_sym] != nil
- name = "first_name".to_sym
- value = attributes["firstName"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- if User.attribute_map["password".to_sym] != nil
- name = "password".to_sym
- value = attributes["password"]
- send("#{name}=", value) if self.respond_to?(name)
- end
- end
end
def to_body
body = {}
- User.attribute_map.each_pair do |key,value|
+ self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil?
end
body
diff --git a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala
index 2c6cc8ab6f0..5a1ee6ad3a4 100644
--- a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala
+++ b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala
@@ -43,7 +43,7 @@ class UserApi {
case ex: ApiException => throw ex
}
}
- def createUsersWithArrayInput (body: Array[User]) = {
+ def createUsersWithArrayInput (body: List[User]) = {
// create path and map variables
val path = "/user/createWithArray".replaceAll("\\{format\\}","json")
val contentType = {
@@ -71,7 +71,7 @@ class UserApi {
case ex: ApiException => throw ex
}
}
- def createUsersWithListInput (body: Array[User]) = {
+ def createUsersWithListInput (body: List[User]) = {
// create path and map variables
val path = "/user/createWithList".replaceAll("\\{format\\}","json")
val contentType = {
diff --git a/samples/client/petstore/scala/src/test/scala/UserApiTest.scala b/samples/client/petstore/scala/src/test/scala/UserApiTest.scala
index 60bdaa78b87..e6aed8482d1 100644
--- a/samples/client/petstore/scala/src/test/scala/UserApiTest.scala
+++ b/samples/client/petstore/scala/src/test/scala/UserApiTest.scala
@@ -79,7 +79,7 @@ class UserApiTest extends FlatSpec with ShouldMatchers {
"XXXXXXXXXXX",
"408-867-5309",
1)
- }).toArray
+ }).toList
api.createUsersWithArrayInput(userArray)
for (i <- (1 to 2)) {
@@ -104,7 +104,7 @@ class UserApiTest extends FlatSpec with ShouldMatchers {
"XXXXXXXXXXX",
"408-867-5309",
1)
- }).toArray
+ }).toList
api.createUsersWithListInput(userList)
for (i <- (1 to 3)) {