forked from loafle/openapi-generator-original
Merge pull request #651 from wing328/method_name_style
Update method name based on style guide
This commit is contained in:
commit
cbbe29cf70
@ -838,7 +838,8 @@ public class DefaultCodegen {
|
||||
// op.cookieParams = cookieParams;
|
||||
op.formParams = addHasMore(formParams);
|
||||
// legacy support
|
||||
op.nickname = operationId;
|
||||
op.nickname = op.operationId;
|
||||
|
||||
|
||||
if(op.allParams.size() > 0)
|
||||
op.hasParams = true;
|
||||
|
@ -162,5 +162,14 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
return toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
return camelize(operationId, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -163,4 +163,14 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
type = swaggerType;
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
return camelize(operationId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -160,4 +160,15 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
type = swaggerType;
|
||||
return toModelName(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
return camelize(operationId, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -276,4 +276,14 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public String escapeReservedWord(String name) {
|
||||
return "_" + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
return camelize(operationId, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -186,4 +186,13 @@ public class Python3ClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
return underscore(name) + "_api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
return underscore(operationId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -196,4 +196,13 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return underscore(name) + "_api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
return underscore(operationId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -189,4 +189,14 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return camelize(name) + "Api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
return underscore(operationId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -189,4 +189,15 @@ public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
else
|
||||
return "null";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
return camelize(operationId, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -244,4 +244,15 @@ public class TizenClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
public String escapeReservedWord(String name) {
|
||||
return "_" + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// method name cannot use reserved keyword, e.g. return$
|
||||
if(reservedWords.contains(operationId))
|
||||
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||
|
||||
// add_pet_by_id => addPetById
|
||||
return camelize(operationId, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.*;
|
||||
import org.apache.http.impl.conn.*;
|
||||
import org.apache.http.impl.conn.tsccm.*;
|
||||
import org.apache.http.params.*;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
@ -381,7 +382,7 @@ public class ApiInvoker {
|
||||
schemeRegistry.register(httpsScheme);
|
||||
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
|
||||
|
||||
ignoreSSLConnectionManager = new SingleClientConnManager(new BasicHttpParams(), schemeRegistry);
|
||||
ignoreSSLConnectionManager = new ThreadSafeClientConnManager(new BasicHttpParams(), schemeRegistry);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// This will only be thrown if SSL isn't available for some reason.
|
||||
} catch (KeyManagementException e) {
|
||||
|
@ -36,7 +36,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Body">Pet object that needs to be added to the store</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void updatePet (Pet Body) {
|
||||
public void UpdatePet (Pet Body) {
|
||||
// create path and map variables
|
||||
var path = "/pet".Replace("{format}","json");
|
||||
|
||||
@ -84,7 +84,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Body">Pet object that needs to be added to the store</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void addPet (Pet Body) {
|
||||
public void AddPet (Pet Body) {
|
||||
// create path and map variables
|
||||
var path = "/pet".Replace("{format}","json");
|
||||
|
||||
@ -132,7 +132,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Status">Status values that need to be considered for filter</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public List<Pet> findPetsByStatus (List<string> Status) {
|
||||
public List<Pet> FindPetsByStatus (List<string> Status) {
|
||||
// create path and map variables
|
||||
var path = "/pet/findByStatus".Replace("{format}","json");
|
||||
|
||||
@ -188,7 +188,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Tags">Tags to filter by</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public List<Pet> findPetsByTags (List<string> Tags) {
|
||||
public List<Pet> FindPetsByTags (List<string> Tags) {
|
||||
// create path and map variables
|
||||
var path = "/pet/findByTags".Replace("{format}","json");
|
||||
|
||||
@ -244,7 +244,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="PetId">ID of pet that needs to be fetched</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public Pet getPetById (long? PetId) {
|
||||
public Pet GetPetById (long? PetId) {
|
||||
// create path and map variables
|
||||
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId));
|
||||
|
||||
@ -299,7 +299,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Status">Updated status of the pet</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void updatePetWithForm (string PetId, string Name, string Status) {
|
||||
public void UpdatePetWithForm (string PetId, string Name, string Status) {
|
||||
// create path and map variables
|
||||
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId));
|
||||
|
||||
@ -362,7 +362,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="PetId">Pet id to delete</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void deletePet (string ApiKey, long? PetId) {
|
||||
public void DeletePet (string ApiKey, long? PetId) {
|
||||
// create path and map variables
|
||||
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId));
|
||||
|
||||
@ -413,7 +413,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="File">file to upload</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void uploadFile (long? PetId, string AdditionalMetadata, byte[] File) {
|
||||
public void UploadFile (long? PetId, string AdditionalMetadata, byte[] File) {
|
||||
// create path and map variables
|
||||
var path = "/pet/{petId}/uploadImage".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.ParameterToString(PetId));
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace io.swagger.Api {
|
||||
/// </summary>
|
||||
|
||||
/// <returns></returns>
|
||||
public Dictionary<String, int?> getInventory () {
|
||||
public Dictionary<String, int?> GetInventory () {
|
||||
// create path and map variables
|
||||
var path = "/store/inventory".Replace("{format}","json");
|
||||
|
||||
@ -88,7 +88,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Body">order placed for purchasing the pet</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public Order placeOrder (Order Body) {
|
||||
public Order PlaceOrder (Order Body) {
|
||||
// create path and map variables
|
||||
var path = "/store/order".Replace("{format}","json");
|
||||
|
||||
@ -141,7 +141,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="OrderId">ID of pet that needs to be fetched</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public Order getOrderById (string OrderId) {
|
||||
public Order GetOrderById (string OrderId) {
|
||||
// create path and map variables
|
||||
var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.ParameterToString(OrderId));
|
||||
|
||||
@ -194,7 +194,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="OrderId">ID of the order that needs to be deleted</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void deleteOrder (string OrderId) {
|
||||
public void DeleteOrder (string OrderId) {
|
||||
// create path and map variables
|
||||
var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.ParameterToString(OrderId));
|
||||
|
||||
|
@ -36,7 +36,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Body">Created user object</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void createUser (User Body) {
|
||||
public void CreateUser (User Body) {
|
||||
// create path and map variables
|
||||
var path = "/user".Replace("{format}","json");
|
||||
|
||||
@ -84,7 +84,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Body">List of user object</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void createUsersWithArrayInput (List<User> Body) {
|
||||
public void CreateUsersWithArrayInput (List<User> Body) {
|
||||
// create path and map variables
|
||||
var path = "/user/createWithArray".Replace("{format}","json");
|
||||
|
||||
@ -132,7 +132,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Body">List of user object</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void createUsersWithListInput (List<User> Body) {
|
||||
public void CreateUsersWithListInput (List<User> Body) {
|
||||
// create path and map variables
|
||||
var path = "/user/createWithList".Replace("{format}","json");
|
||||
|
||||
@ -181,7 +181,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Password">The password for login in clear text</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public string loginUser (string Username, string Password) {
|
||||
public string LoginUser (string Username, string Password) {
|
||||
// create path and map variables
|
||||
var path = "/user/login".Replace("{format}","json");
|
||||
|
||||
@ -239,7 +239,7 @@ namespace io.swagger.Api {
|
||||
/// </summary>
|
||||
|
||||
/// <returns></returns>
|
||||
public void logoutUser () {
|
||||
public void LogoutUser () {
|
||||
// create path and map variables
|
||||
var path = "/user/logout".Replace("{format}","json");
|
||||
|
||||
@ -287,7 +287,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Username">The name that needs to be fetched. Use user1 for testing. </param>
|
||||
|
||||
/// <returns></returns>
|
||||
public User getUserByName (string Username) {
|
||||
public User GetUserByName (string Username) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username));
|
||||
|
||||
@ -341,7 +341,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Body">Updated user object</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void updateUser (string Username, User Body) {
|
||||
public void UpdateUser (string Username, User Body) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username));
|
||||
|
||||
@ -389,7 +389,7 @@ namespace io.swagger.Api {
|
||||
/// <param name="Username">The name that needs to be deleted</param>
|
||||
|
||||
/// <returns></returns>
|
||||
public void deleteUser (string Username) {
|
||||
public void DeleteUser (string Username) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.ParameterToString(Username));
|
||||
|
||||
|
@ -15,10 +15,21 @@
|
||||
return _instance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add default header
|
||||
/// </summary>
|
||||
/// <param name="key"> Header field name
|
||||
/// <param name="value"> Header field value
|
||||
/// <returns></returns>
|
||||
public void addDefaultHeader(string key, string value) {
|
||||
defaultHeaderMap.Add(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// escape string (url-encoded)
|
||||
/// </summary>
|
||||
/// <param name="str"> String to be escaped
|
||||
/// <returns>Escaped string</returns>
|
||||
public string escapeString(string str) {
|
||||
return str;
|
||||
}
|
||||
@ -27,12 +38,18 @@
|
||||
/// if parameter is DateTime, output in ISO8601 format, otherwise just return the string
|
||||
/// </summary>
|
||||
/// <param name="obj"> The parameter (header, path, query, form)
|
||||
/// <returns></returns>
|
||||
/// <returns>Formatted string</returns>
|
||||
public string ParameterToString(object obj)
|
||||
{
|
||||
return (obj is DateTime) ? ((DateTime)obj).ToString ("u") : Convert.ToString (obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize the JSON string into a proper object
|
||||
/// </summary>
|
||||
/// <param name="json"> JSON string
|
||||
/// <param name="type"> Object type
|
||||
/// <returns>Object representation of the JSON string</returns>
|
||||
public static object deserialize(string json, Type type) {
|
||||
try
|
||||
{
|
||||
@ -109,6 +126,7 @@
|
||||
case "GET":
|
||||
break;
|
||||
case "POST":
|
||||
case "PATCH":
|
||||
case "PUT":
|
||||
case "DELETE":
|
||||
using (Stream requestStream = client.GetRequestStream())
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "SwaggerPetstore/SwaggerPetstore-php",
|
||||
"name": "SwaggerClient/SwaggerClient-php",
|
||||
"description": "",
|
||||
"keywords": [
|
||||
"swagger",
|
||||
@ -27,6 +27,6 @@
|
||||
"squizlabs/php_codesniffer": "~2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "SwaggerPetstore\\" : "lib/" }
|
||||
"psr-4": { "SwaggerClient\\" : "lib/" }
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
namespace SwaggerClient;
|
||||
|
||||
class APIClient {
|
||||
|
||||
@ -94,7 +94,7 @@ class APIClient {
|
||||
$headers[] = $this->headerName . ": " . $this->headerValue;
|
||||
}
|
||||
|
||||
if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) {
|
||||
if ((isset($headerName['Content-Type']) and strpos($headerName['Content-Type'], "multipart/form-data") === FALSE) and (is_object($postData) or is_array($postData))) {
|
||||
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||
}
|
||||
|
||||
@ -286,11 +286,11 @@ class APIClient {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
} else {
|
||||
$class = "SwaggerPetstore\\models\\".$class;
|
||||
$class = "SwaggerClient\\models\\".$class;
|
||||
$instance = new $class();
|
||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||
if (isset($data->$property)) {
|
||||
$original_property_name = $instance::$attributeMap[$property];
|
||||
$original_property_name = $instance::$attributeMap[$property];
|
||||
if (isset($original_property_name)) {
|
||||
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
namespace SwaggerClient;
|
||||
|
||||
use \Exception;
|
||||
|
@ -20,7 +20,7 @@
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
namespace SwaggerClient;
|
||||
|
||||
class PetApi {
|
||||
|
||||
@ -59,18 +59,18 @@ class PetApi {
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
$_tempBody = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
$_tempBody = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -112,18 +112,18 @@ class PetApi {
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
$_tempBody = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
$_tempBody = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -170,12 +170,12 @@ class PetApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -228,12 +228,12 @@ class PetApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -287,12 +287,12 @@ class PetApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -354,12 +354,12 @@ class PetApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -411,12 +411,12 @@ class PetApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -472,12 +472,12 @@ class PetApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
namespace SwaggerClient;
|
||||
|
||||
class StoreApi {
|
||||
|
||||
@ -60,12 +60,12 @@ class StoreApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -113,18 +113,18 @@ class StoreApi {
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
$_tempBody = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
$_tempBody = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -178,12 +178,12 @@ class StoreApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -237,12 +237,12 @@ class StoreApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
namespace SwaggerClient;
|
||||
|
||||
class UserApi {
|
||||
|
||||
@ -59,18 +59,18 @@ class UserApi {
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
$_tempBody = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
$_tempBody = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -112,18 +112,18 @@ class UserApi {
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
$_tempBody = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
$_tempBody = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -165,18 +165,18 @@ class UserApi {
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
$_tempBody = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
$_tempBody = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -227,12 +227,12 @@ class UserApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -281,12 +281,12 @@ class UserApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -334,12 +334,12 @@ class UserApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -392,18 +392,18 @@ class UserApi {
|
||||
}
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
$_tempBody = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
$_tempBody = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
@ -451,12 +451,12 @@ class UserApi {
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
namespace SwaggerClient\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
@ -22,7 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
namespace SwaggerClient\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
@ -22,7 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
namespace SwaggerClient\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
@ -22,7 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
namespace SwaggerClient\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
@ -22,7 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
namespace SwaggerClient\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
@ -1,19 +1,16 @@
|
||||
<?php
|
||||
|
||||
require_once('SwaggerPetstore.php');
|
||||
|
||||
require_once('SwaggerClient.php');
|
||||
class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetPetById()
|
||||
{
|
||||
// initialize the API client
|
||||
$api_client = new SwaggerPetstore\APIClient('http://petstore.swagger.io/v2');
|
||||
$petId = 5; // ID of pet that needs to be fetched
|
||||
$pet_api = new SwaggerPetstore\PetAPI($api_client);
|
||||
$api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2');
|
||||
$petId = 10005; // ID of pet that needs to be fetched
|
||||
$pet_api = new SwaggerClient\PetAPI($api_client);
|
||||
// return Pet (model)
|
||||
$response = $pet_api->getPetById($petId);
|
||||
$this->assertSame($response->id, $petId);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
//require_once('vendor/autoload.php');
|
||||
require_once('SwaggerPetstore-php/SwaggerPetstore.php');
|
||||
require_once('SwaggerClient-php/SwaggerClient.php');
|
||||
|
||||
// initialize the API client
|
||||
$api_client = new SwaggerPetstore\APIClient('http://petstore.swagger.io/v2');
|
||||
$petId = 5; // ID of pet that needs to be fetched
|
||||
$api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2');
|
||||
$petId = 10005; // ID of pet that needs to be fetched
|
||||
try {
|
||||
$pet_api = new SwaggerPetstore\PetAPI($api_client);
|
||||
$pet_api = new SwaggerClient\PetAPI($api_client);
|
||||
// return Pet (model)
|
||||
$response = $pet_api->getPetById($petId);
|
||||
var_dump($response);
|
||||
|
@ -33,7 +33,7 @@ class PetApi(object):
|
||||
|
||||
|
||||
|
||||
def updatePet(self, **kwargs):
|
||||
def update_pet(self, **kwargs):
|
||||
"""Update an existing pet
|
||||
|
||||
Args:
|
||||
@ -50,7 +50,7 @@ class PetApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method updatePet" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method update_pet" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -92,7 +92,7 @@ class PetApi(object):
|
||||
|
||||
|
||||
|
||||
def addPet(self, **kwargs):
|
||||
def add_pet(self, **kwargs):
|
||||
"""Add a new pet to the store
|
||||
|
||||
Args:
|
||||
@ -109,7 +109,7 @@ class PetApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method addPet" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method add_pet" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -151,7 +151,7 @@ class PetApi(object):
|
||||
|
||||
|
||||
|
||||
def findPetsByStatus(self, **kwargs):
|
||||
def find_pets_by_status(self, **kwargs):
|
||||
"""Finds Pets by status
|
||||
|
||||
Args:
|
||||
@ -168,7 +168,7 @@ class PetApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method findPetsByStatus" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method find_pets_by_status" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -216,7 +216,7 @@ class PetApi(object):
|
||||
|
||||
|
||||
|
||||
def findPetsByTags(self, **kwargs):
|
||||
def find_pets_by_tags(self, **kwargs):
|
||||
"""Finds Pets by tags
|
||||
|
||||
Args:
|
||||
@ -233,7 +233,7 @@ class PetApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method findPetsByTags" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method find_pets_by_tags" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -281,7 +281,7 @@ class PetApi(object):
|
||||
|
||||
|
||||
|
||||
def getPetById(self, **kwargs):
|
||||
def get_pet_by_id(self, **kwargs):
|
||||
"""Find pet by ID
|
||||
|
||||
Args:
|
||||
@ -298,7 +298,7 @@ class PetApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method getPetById" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method get_pet_by_id" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -349,7 +349,7 @@ class PetApi(object):
|
||||
|
||||
|
||||
|
||||
def updatePetWithForm(self, **kwargs):
|
||||
def update_pet_with_form(self, **kwargs):
|
||||
"""Updates a pet in the store with form data
|
||||
|
||||
Args:
|
||||
@ -372,7 +372,7 @@ class PetApi(object):
|
||||
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)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method update_pet_with_form" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -423,7 +423,7 @@ class PetApi(object):
|
||||
|
||||
|
||||
|
||||
def deletePet(self, **kwargs):
|
||||
def delete_pet(self, **kwargs):
|
||||
"""Deletes a pet
|
||||
|
||||
Args:
|
||||
@ -443,7 +443,7 @@ class PetApi(object):
|
||||
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)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method delete_pet" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -491,7 +491,7 @@ class PetApi(object):
|
||||
|
||||
|
||||
|
||||
def uploadFile(self, **kwargs):
|
||||
def upload_file(self, **kwargs):
|
||||
"""uploads an image
|
||||
|
||||
Args:
|
||||
@ -514,7 +514,7 @@ class PetApi(object):
|
||||
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)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method upload_file" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
|
@ -33,7 +33,7 @@ class StoreApi(object):
|
||||
|
||||
|
||||
|
||||
def getInventory(self, **kwargs):
|
||||
def get_inventory(self, **kwargs):
|
||||
"""Returns pet inventories by status
|
||||
|
||||
Args:
|
||||
@ -47,7 +47,7 @@ class StoreApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method getInventory" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method get_inventory" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -92,7 +92,7 @@ class StoreApi(object):
|
||||
|
||||
|
||||
|
||||
def placeOrder(self, **kwargs):
|
||||
def place_order(self, **kwargs):
|
||||
"""Place an order for a pet
|
||||
|
||||
Args:
|
||||
@ -109,7 +109,7 @@ class StoreApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method placeOrder" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method place_order" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -157,7 +157,7 @@ class StoreApi(object):
|
||||
|
||||
|
||||
|
||||
def getOrderById(self, **kwargs):
|
||||
def get_order_by_id(self, **kwargs):
|
||||
"""Find purchase order by ID
|
||||
|
||||
Args:
|
||||
@ -174,7 +174,7 @@ class StoreApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method getOrderById" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method get_order_by_id" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -225,7 +225,7 @@ class StoreApi(object):
|
||||
|
||||
|
||||
|
||||
def deleteOrder(self, **kwargs):
|
||||
def delete_order(self, **kwargs):
|
||||
"""Delete purchase order by ID
|
||||
|
||||
Args:
|
||||
@ -242,7 +242,7 @@ class StoreApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method deleteOrder" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method delete_order" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
|
@ -33,7 +33,7 @@ class UserApi(object):
|
||||
|
||||
|
||||
|
||||
def createUser(self, **kwargs):
|
||||
def create_user(self, **kwargs):
|
||||
"""Create user
|
||||
|
||||
Args:
|
||||
@ -50,7 +50,7 @@ class UserApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method createUser" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method create_user" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -92,7 +92,7 @@ class UserApi(object):
|
||||
|
||||
|
||||
|
||||
def createUsersWithArrayInput(self, **kwargs):
|
||||
def create_users_with_array_input(self, **kwargs):
|
||||
"""Creates list of users with given input array
|
||||
|
||||
Args:
|
||||
@ -109,7 +109,7 @@ class UserApi(object):
|
||||
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)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method create_users_with_array_input" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -151,7 +151,7 @@ class UserApi(object):
|
||||
|
||||
|
||||
|
||||
def createUsersWithListInput(self, **kwargs):
|
||||
def create_users_with_list_input(self, **kwargs):
|
||||
"""Creates list of users with given input array
|
||||
|
||||
Args:
|
||||
@ -168,7 +168,7 @@ class UserApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithListInput" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method create_users_with_list_input" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -210,7 +210,7 @@ class UserApi(object):
|
||||
|
||||
|
||||
|
||||
def loginUser(self, **kwargs):
|
||||
def login_user(self, **kwargs):
|
||||
"""Logs user into the system
|
||||
|
||||
Args:
|
||||
@ -230,7 +230,7 @@ class UserApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method loginUser" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method login_user" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -281,7 +281,7 @@ class UserApi(object):
|
||||
|
||||
|
||||
|
||||
def logoutUser(self, **kwargs):
|
||||
def logout_user(self, **kwargs):
|
||||
"""Logs out current logged in user session
|
||||
|
||||
Args:
|
||||
@ -295,7 +295,7 @@ class UserApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method logoutUser" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method logout_user" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -334,7 +334,7 @@ class UserApi(object):
|
||||
|
||||
|
||||
|
||||
def getUserByName(self, **kwargs):
|
||||
def get_user_by_name(self, **kwargs):
|
||||
"""Get user by user name
|
||||
|
||||
Args:
|
||||
@ -351,7 +351,7 @@ class UserApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method getUserByName" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method get_user_by_name" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -402,7 +402,7 @@ class UserApi(object):
|
||||
|
||||
|
||||
|
||||
def updateUser(self, **kwargs):
|
||||
def update_user(self, **kwargs):
|
||||
"""Updated user
|
||||
|
||||
Args:
|
||||
@ -422,7 +422,7 @@ class UserApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method updateUser" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method update_user" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
@ -470,7 +470,7 @@ class UserApi(object):
|
||||
|
||||
|
||||
|
||||
def deleteUser(self, **kwargs):
|
||||
def delete_user(self, **kwargs):
|
||||
"""Delete user
|
||||
|
||||
Args:
|
||||
@ -487,7 +487,7 @@ class UserApi(object):
|
||||
params = locals()
|
||||
for (key, val) in params['kwargs'].iteritems():
|
||||
if key not in allParams:
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method deleteUser" % key)
|
||||
raise TypeError("Got an unexpected keyword argument '%s' to method delete_user" % key)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
|
||||
|
@ -9,7 +9,7 @@ class PetApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return void
|
||||
def self.updatePet(opts = {})
|
||||
def self.update_pet(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -61,7 +61,7 @@ class PetApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return void
|
||||
def self.addPet(opts = {})
|
||||
def self.add_pet(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -113,7 +113,7 @@ class PetApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [array[string]] :status Status values that need to be considered for filter
|
||||
# @return array[Pet]
|
||||
def self.findPetsByStatus(opts = {})
|
||||
def self.find_pets_by_status(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -147,7 +147,7 @@ class PetApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [array[string]] :tags Tags to filter by
|
||||
# @return array[Pet]
|
||||
def self.findPetsByTags(opts = {})
|
||||
def self.find_pets_by_tags(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -181,7 +181,7 @@ class PetApi
|
||||
# @param pet_id ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return Pet
|
||||
def self.getPetById(pet_id, opts = {})
|
||||
def self.get_pet_by_id(pet_id, opts = {})
|
||||
# verify existence of params
|
||||
raise "pet_id is required" if pet_id.nil?
|
||||
|
||||
@ -217,7 +217,7 @@ class PetApi
|
||||
# @option opts [string] :name Updated name of the pet
|
||||
# @option opts [string] :status Updated status of the pet
|
||||
# @return void
|
||||
def self.updatePetWithForm(pet_id, opts = {})
|
||||
def self.update_pet_with_form(pet_id, opts = {})
|
||||
# verify existence of params
|
||||
raise "pet_id is required" if pet_id.nil?
|
||||
|
||||
@ -253,7 +253,7 @@ class PetApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [string] :api_key
|
||||
# @return void
|
||||
def self.deletePet(pet_id, opts = {})
|
||||
def self.delete_pet(pet_id, opts = {})
|
||||
# verify existence of params
|
||||
raise "pet_id is required" if pet_id.nil?
|
||||
|
||||
@ -289,7 +289,7 @@ class PetApi
|
||||
# @option opts [string] :additional_metadata Additional data to pass to server
|
||||
# @option opts [file] :file file to upload
|
||||
# @return void
|
||||
def self.uploadFile(pet_id, opts = {})
|
||||
def self.upload_file(pet_id, opts = {})
|
||||
# verify existence of params
|
||||
raise "pet_id is required" if pet_id.nil?
|
||||
|
||||
|
@ -8,7 +8,7 @@ class StoreApi
|
||||
# Returns a map of status codes to quantities
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return map[string,int]
|
||||
def self.getInventory(opts = {})
|
||||
def self.get_inventory(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -41,7 +41,7 @@ class StoreApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Order] :body order placed for purchasing the pet
|
||||
# @return Order
|
||||
def self.placeOrder(opts = {})
|
||||
def self.place_order(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -94,7 +94,7 @@ class StoreApi
|
||||
# @param order_id ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return Order
|
||||
def self.getOrderById(order_id, opts = {})
|
||||
def self.get_order_by_id(order_id, opts = {})
|
||||
# verify existence of params
|
||||
raise "order_id is required" if order_id.nil?
|
||||
|
||||
@ -128,7 +128,7 @@ class StoreApi
|
||||
# @param order_id ID of the order that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return void
|
||||
def self.deleteOrder(order_id, opts = {})
|
||||
def self.delete_order(order_id, opts = {})
|
||||
# verify existence of params
|
||||
raise "order_id is required" if order_id.nil?
|
||||
|
||||
|
@ -9,7 +9,7 @@ class UserApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [User] :body Created user object
|
||||
# @return void
|
||||
def self.createUser(opts = {})
|
||||
def self.create_user(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -61,7 +61,7 @@ class UserApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [array[User]] :body List of user object
|
||||
# @return void
|
||||
def self.createUsersWithArrayInput(opts = {})
|
||||
def self.create_users_with_array_input(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -113,7 +113,7 @@ class UserApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [array[User]] :body List of user object
|
||||
# @return void
|
||||
def self.createUsersWithListInput(opts = {})
|
||||
def self.create_users_with_list_input(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -166,7 +166,7 @@ class UserApi
|
||||
# @option opts [string] :username The user name for login
|
||||
# @option opts [string] :password The password for login in clear text
|
||||
# @return string
|
||||
def self.loginUser(opts = {})
|
||||
def self.login_user(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -200,7 +200,7 @@ class UserApi
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return void
|
||||
def self.logoutUser(opts = {})
|
||||
def self.logout_user(opts = {})
|
||||
# verify existence of params
|
||||
|
||||
# resource path
|
||||
@ -232,7 +232,7 @@ class UserApi
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return User
|
||||
def self.getUserByName(username, opts = {})
|
||||
def self.get_user_by_name(username, opts = {})
|
||||
# verify existence of params
|
||||
raise "username is required" if username.nil?
|
||||
|
||||
@ -267,7 +267,7 @@ class UserApi
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [User] :body Updated user object
|
||||
# @return void
|
||||
def self.updateUser(username, opts = {})
|
||||
def self.update_user(username, opts = {})
|
||||
# verify existence of params
|
||||
raise "username is required" if username.nil?
|
||||
|
||||
@ -320,7 +320,7 @@ class UserApi
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return void
|
||||
def self.deleteUser(username, opts = {})
|
||||
def self.delete_user(username, opts = {})
|
||||
# verify existence of params
|
||||
raise "username is required" if username.nil?
|
||||
|
||||
|
@ -8,24 +8,24 @@ describe "Pet" do
|
||||
|
||||
describe "pet methods" do
|
||||
it "should fetch a pet object" do
|
||||
pet = PetApi.getPetById(10002)
|
||||
pet = PetApi.get_pet_by_id(10002)
|
||||
pet.should be_a(Pet)
|
||||
pet.id.should == 10002
|
||||
pet.name.should == "RUBY UNIT TESTING"
|
||||
end
|
||||
|
||||
it "should find pets by status" do
|
||||
pets = PetApi.findPetsByStatus(:status => 'available')
|
||||
pets = PetApi.find_pets_by_status(:status => 'available')
|
||||
pets.length.should >= 3
|
||||
end
|
||||
|
||||
it "should not find a pet with invalid status" do
|
||||
pets = PetApi.findPetsByStatus(:status => 'invalid-status')
|
||||
pets = PetApi.find_pets_by_status(:status => 'invalid-status')
|
||||
pets.length.should == 0
|
||||
end
|
||||
|
||||
it "should find a pet by status" do
|
||||
pets = PetApi.findPetsByStatus(:status => "available,sold")
|
||||
pets = PetApi.find_pets_by_status(:status => "available,sold")
|
||||
pets.map {|pet|
|
||||
if(pet.status != 'available' && pet.status != 'sold')
|
||||
raise "pet status wasn't right"
|
||||
@ -35,18 +35,18 @@ describe "Pet" do
|
||||
|
||||
it "should update a pet" do
|
||||
pet = Pet.new({'id' => 10002, 'status' => 'sold'})
|
||||
PetApi.addPet(:body => pet)
|
||||
PetApi.add_pet(:body => pet)
|
||||
|
||||
fetched = PetApi.getPetById(10002)
|
||||
fetched = PetApi.get_pet_by_id(10002)
|
||||
fetched.id.should == 10002
|
||||
fetched.status.should == 'sold'
|
||||
end
|
||||
|
||||
it "should create a pet" do
|
||||
pet = Pet.new('id' => 10002, 'name' => "RUBY UNIT TESTING")
|
||||
PetApi.addPet(:body => pet)
|
||||
PetApi.add_pet(:body => pet)
|
||||
|
||||
pet = PetApi.getPetById(10002)
|
||||
pet = PetApi.get_pet_by_id(10002)
|
||||
pet.id.should == 10002
|
||||
pet.name.should == "RUBY UNIT TESTING"
|
||||
end
|
||||
|
@ -47,10 +47,10 @@ end
|
||||
# always delete and then re-create the pet object with 10002
|
||||
def prepare_pet
|
||||
# remove the pet
|
||||
PetApi.deletePet(10002, :api_key => 'special-key')
|
||||
PetApi.delete_pet(10002)
|
||||
# recreate the pet
|
||||
pet = Pet.new('id' => 10002, 'name' => "RUBY UNIT TESTING")
|
||||
PetApi.addPet(:body => pet)
|
||||
PetApi.add_pet(:body => pet)
|
||||
end
|
||||
|
||||
# always delete and then re-create the store order
|
||||
@ -61,7 +61,7 @@ def prepare_store
|
||||
"shipDate" => "2015-04-06T23:42:01.678Z",
|
||||
"status" => "placed",
|
||||
"complete" => false)
|
||||
StoreApi.placeOrder(:body => order)
|
||||
StoreApi.place_order(:body => order)
|
||||
end
|
||||
|
||||
configure_swagger
|
||||
|
@ -7,7 +7,7 @@ describe "Store" do
|
||||
end
|
||||
|
||||
it "should fetch an order" do
|
||||
item = StoreApi.getOrderById(10002)
|
||||
item = StoreApi.get_order_by_id(10002)
|
||||
item.id.should == 10002
|
||||
end
|
||||
end
|
||||
|
@ -420,7 +420,7 @@
|
||||
|
||||
<h3 class="field-label">Example data</h3>
|
||||
<div class="example-data-content-type">Content-Type: application/xml</div>
|
||||
<pre class="example"><code>not implemented com.wordnik.swagger.models.properties.MapProperty@2acca551</code></pre>
|
||||
<pre class="example"><code>not implemented com.wordnik.swagger.models.properties.MapProperty@3c536f11</code></pre>
|
||||
|
||||
</div> <!-- method -->
|
||||
<hr>
|
||||
@ -444,11 +444,11 @@
|
||||
|
||||
<h3 class="field-label">Example data</h3>
|
||||
<div class="example-data-content-type">Content-Type: application/json</div>
|
||||
<pre class="example"><code>{\n "id" : 123456789,\n "petId" : 123456789,\n "complete" : true,\n "status" : "aeiou",\n "quantity" : 123,\n "shipDate" : "2015-04-05T03:02:18.855+0000"\n}</code></pre>
|
||||
<pre class="example"><code>{\n "id" : 123456789,\n "petId" : 123456789,\n "complete" : true,\n "status" : "aeiou",\n "quantity" : 123,\n "shipDate" : "2015-04-16T14:41:29.883+0000"\n}</code></pre>
|
||||
|
||||
<h3 class="field-label">Example data</h3>
|
||||
<div class="example-data-content-type">Content-Type: application/xml</div>
|
||||
<pre class="example"><code><Order>\n <id>123456</id>\n <petId>123456</petId>\n <quantity>0</quantity>\n <shipDate>2015-04-04T20:02:18.857Z</shipDate>\n <status>string</status>\n <complete>true</complete>\n</Order></code></pre>
|
||||
<pre class="example"><code><Order>\n <id>123456</id>\n <petId>123456</petId>\n <quantity>0</quantity>\n <shipDate>2015-04-16T22:41:29.886Z</shipDate>\n <status>string</status>\n <complete>true</complete>\n</Order></code></pre>
|
||||
|
||||
</div> <!-- method -->
|
||||
<hr>
|
||||
@ -472,11 +472,11 @@
|
||||
|
||||
<h3 class="field-label">Example data</h3>
|
||||
<div class="example-data-content-type">Content-Type: application/json</div>
|
||||
<pre class="example"><code>{\n "id" : 123456789,\n "petId" : 123456789,\n "complete" : true,\n "status" : "aeiou",\n "quantity" : 123,\n "shipDate" : "2015-04-05T03:02:18.859+0000"\n}</code></pre>
|
||||
<pre class="example"><code>{\n "id" : 123456789,\n "petId" : 123456789,\n "complete" : true,\n "status" : "aeiou",\n "quantity" : 123,\n "shipDate" : "2015-04-16T14:41:29.887+0000"\n}</code></pre>
|
||||
|
||||
<h3 class="field-label">Example data</h3>
|
||||
<div class="example-data-content-type">Content-Type: application/xml</div>
|
||||
<pre class="example"><code><Order>\n <id>123456</id>\n <petId>123456</petId>\n <quantity>0</quantity>\n <shipDate>2015-04-04T20:02:18.859Z</shipDate>\n <status>string</status>\n <complete>true</complete>\n</Order></code></pre>
|
||||
<pre class="example"><code><Order>\n <id>123456</id>\n <petId>123456</petId>\n <quantity>0</quantity>\n <shipDate>2015-04-16T22:41:29.888Z</shipDate>\n <status>string</status>\n <complete>true</complete>\n</Order></code></pre>
|
||||
|
||||
</div> <!-- method -->
|
||||
<hr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user