Merge branch 'develop_2.0' into develop_2.0_python_better_import

Conflicts:
	modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/PythonClientCodegen.java
This commit is contained in:
geekerzp 2015-04-09 09:31:50 +08:00
commit 806c26d54f
28 changed files with 403 additions and 161 deletions

View File

@ -18,7 +18,7 @@ The Swagger Specification has undergone 3 revisions since initial creation in 20
Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes
----------------------- | ------------ | -------------------------- | ----- ----------------------- | ------------ | -------------------------- | -----
1.5.0-M2 | 2015-04-06 | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen) 2.1.1-M2-SNAPSHOT | 2015-04-06 | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17) 2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1) 1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>com.wordnik</groupId> <groupId>com.wordnik</groupId>
<artifactId>swagger-codegen-project</artifactId> <artifactId>swagger-codegen-project</artifactId>
<version>1.5.0-M2</version> <version>2.1.1-M2-SNAPSHOT</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -2,7 +2,7 @@
<parent> <parent>
<groupId>com.wordnik</groupId> <groupId>com.wordnik</groupId>
<artifactId>swagger-codegen-project</artifactId> <artifactId>swagger-codegen-project</artifactId>
<version>1.5.0-M2</version> <version>2.1.1-M2-SNAPSHOT</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -10,7 +10,7 @@
<artifactId>swagger-codegen</artifactId> <artifactId>swagger-codegen</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>swagger-codegen (core library)</name> <name>swagger-codegen (core library)</name>
<version>1.5.0-M2</version> <version>2.1.1-M2-SNAPSHOT</version>
<build> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<defaultGoal>install</defaultGoal> <defaultGoal>install</defaultGoal>

View File

@ -113,5 +113,72 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
public String toDefaultValue(Property p) { public String toDefaultValue(Property p) {
// TODO: Support Python def value // TODO: Support Python def value
return "null"; return "null";
}
@Override
public String toVarName(String name) {
// replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_");
// if it's all uppper case, convert to lower case
if (name.matches("^[A-Z_]*$"))
name = name.toLowerCase();
// camelize (lower first character) the variable name
// petId => pet_id
name = underscore(name);
// for reserved word or word starting with number, append _
if(reservedWords.contains(name) || name.matches("^\\d.*"))
name = escapeReservedWord(name);
return name;
} }
@Override
public String toParamName(String name) {
// should be the same as variable name
return toVarName(name);
}
@Override
public String toModelName(String name) {
// model name cannot use reserved keyword, e.g. return
if(reservedWords.contains(name))
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
// camelize the model name
// phone_number => PhoneNumber
return camelize(name);
}
@Override
public String toModelFilename(String name) {
// model name cannot use reserved keyword, e.g. return
if(reservedWords.contains(name))
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
// underscore the model file name
// PhoneNumber.rb => phone_number.rb
return underscore(name);
}
@Override
public String toApiFilename(String name) {
// replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_");
// e.g. PhoneNumberApi.rb => phone_number_api.rb
return underscore(name) + "_api";
}
@Override
public String toApiName(String name) {
if(name.length() == 0)
return "DefaultApi";
// e.g. phone_number_api => PhoneNumberApi
return camelize(name) + "Api";
}
} }

View File

@ -129,7 +129,7 @@
</repository> </repository>
</repositories> </repositories>
<properties> <properties>
<swagger-core-version>1.5.0-M2</swagger-core-version> <swagger-core-version>2.1.1-M2-SNAPSHOT</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version> <jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version> <jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version> <slf4j-version>1.6.3</slf4j-version>

View File

@ -25,6 +25,16 @@ class APIClient {
public static $PUT = "PUT"; public static $PUT = "PUT";
public static $DELETE = "DELETE"; public static $DELETE = "DELETE";
/*
* @var string timeout (second) of the HTTP request, by default set to 0, no timeout
*/
protected $curl_timeout = 0;
/*
* @var string user agent of the HTTP request, set to "PHP-Swagger" by default
*/
protected $user_agent = "PHP-Swagger";
/** /**
* @param string $host the address of the API server * @param string $host the address of the API server
* @param string $headerName a header to pass on requests * @param string $headerName a header to pass on requests
@ -54,7 +64,7 @@ class APIClient {
if (!is_numeric($seconds)) { if (!is_numeric($seconds)) {
throw new Exception('Timeout variable must be numeric.'); throw new Exception('Timeout variable must be numeric.');
} }
$this->curl_timout = $seconds; $this->curl_timeout = $seconds;
} }
/** /**
@ -84,15 +94,16 @@ class APIClient {
$headers[] = $this->headerName . ": " . $this->headerValue; $headers[] = $this->headerName . ": " . $this->headerValue;
} }
if (strpos($headers['Content-Type'], "multipart/form-data") < 0 and (is_object($postData) or is_array($postData))) { if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) {
$postData = json_encode($this->sanitizeForSerialization($postData)); $postData = json_encode($this->sanitizeForSerialization($postData));
} }
$url = $this->host . $resourcePath; $url = $this->host . $resourcePath;
$curl = curl_init(); $curl = curl_init();
if ($this->curl_timout) { // set timeout, if needed
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timout); if ($this->curl_timeout != 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timeout);
} }
// return the result on success, rather than just TRUE // return the result on success, rather than just TRUE
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@ -120,11 +131,7 @@ class APIClient {
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
// Set user agent // Set user agent
if ($this->user_agent) { curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
} else { // use PHP-Swagger as the default user agent
curl_setopt($curl, CURLOPT_USERAGENT, 'PHP-Swagger');
}
// Make the request // Make the request
$response = curl_exec($curl); $response = curl_exec($curl);

View File

@ -44,6 +44,7 @@ class {{classname}} {
$resourcePath = "{{path}}"; $resourcePath = "{{path}}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "{{httpMethod}}"; $method = "{{httpMethod}}";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -77,16 +78,19 @@ class {{classname}} {
$body = ${{paramName}}; $body = ${{paramName}};
}{{/bodyParams}} }{{/bodyParams}}
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
{{#returnType}}if(! $response) { {{#returnType}}if(! $response) {

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# coding: utf-8
""" """
{{classname}}.py {{classname}}.py
Copyright 2015 Reverb Technologies, Inc. Copyright 2015 Reverb Technologies, Inc.
@ -68,12 +70,12 @@ class {{classname}}(object):
{{#queryParams}} {{#queryParams}}
if ('{{paramName}}' in params): if ('{{paramName}}' in params):
queryParams['{{paramName}}'] = self.apiClient.toPathValue(params['{{paramName}}']) queryParams['{{baseName}}'] = self.apiClient.toPathValue(params['{{paramName}}'])
{{/queryParams}} {{/queryParams}}
{{#headerParams}} {{#headerParams}}
if ('{{paramName}}' in params): if ('{{paramName}}' in params):
headerParams['{{paramName}}'] = params['{{paramName}}'] headerParams['{{baseName}}'] = params['{{paramName}}']
{{/headerParams}} {{/headerParams}}
{{#pathParams}} {{#pathParams}}
@ -86,7 +88,7 @@ class {{classname}}(object):
{{#formParams}} {{#formParams}}
if ('{{paramName}}' in params): if ('{{paramName}}' in params):
{{#notFile}}formParams['{{paramName}}'] = params['{{paramName}}']{{/notFile}}{{#isFile}}files['{{paramName}}'] = params['{{paramName}}']{{/isFile}} {{#notFile}}formParams['{{baseName}}'] = params['{{paramName}}']{{/notFile}}{{#isFile}}files['{{baseName}}'] = params['{{paramName}}']{{/isFile}}
{{/formParams}} {{/formParams}}
{{#bodyParam}} {{#bodyParam}}

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# coding: utf-8
""" """
Copyright 2015 Reverb Technologies, Inc. Copyright 2015 Reverb Technologies, Inc.
@ -39,7 +41,7 @@ class {{classname}}(object):
{{#vars}} {{#vars}}
'{{name}}': '{{baseName}}'{{#hasMore}},{{/hasMore}} '{{name}}': '{{baseName}}'{{#hasMore}},{{/hasMore}}
{{/vars}} {{/vars}}
} }
{{#vars}} {{#vars}}
{{#description}}#{{description}} {{#description}}#{{description}}

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# coding: utf-8
"""Swagger generic API client. This client handles the client- """Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger the methods and models for each application are generated from the Swagger

View File

@ -3,14 +3,14 @@
<parent> <parent>
<groupId>com.wordnik</groupId> <groupId>com.wordnik</groupId>
<artifactId>swagger-codegen-project</artifactId> <artifactId>swagger-codegen-project</artifactId>
<version>1.5.0-M2</version> <version>2.1.1-M2-SNAPSHOT</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<groupId>com.wordnik</groupId> <groupId>com.wordnik</groupId>
<artifactId>swagger-generator</artifactId> <artifactId>swagger-generator</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>swagger-generator</name> <name>swagger-generator</name>
<version>1.5.0-M2</version> <version>2.1.1-M2-SNAPSHOT</version>
<build> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<plugins> <plugins>

View File

@ -9,7 +9,7 @@
<artifactId>swagger-codegen-project</artifactId> <artifactId>swagger-codegen-project</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>swagger-codegen-project</name> <name>swagger-codegen-project</name>
<version>1.5.0-M2</version> <version>2.1.1-M2-SNAPSHOT</version>
<url>https://github.com/swagger-api/swagger-codegen</url> <url>https://github.com/swagger-api/swagger-codegen</url>
<scm> <scm>
<connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection> <connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection>

View File

@ -0,0 +1,52 @@
## Requirements
PHP 5.3.3 and later.
## Composer
You can install the bindings via [Composer](http://getcomposer.org/). Add this to your `composer.json`:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/wing328/SwaggerPetstore-php.git"
}
],
"require": {
"SwaggerPetstore/SwaggerPetstore-php": "*@dev"
}
}
Then install via:
composer install
To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading):
require_once('vendor/autoload.php');
## Manual Installation
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the `SwaggerPetstore.php` file.
require_once('/path/to/SwaggerPetstore-php/SwaggerPetstore.php');
## Getting Started
php test.php
## Documentation
TODO
## Tests
In order to run tests first install [PHPUnit](http://packagist.org/packages/phpunit/phpunit) via [Composer](http://getcomposer.org/):
composer update
To run the test suite:
./vendor/bin/phpunit tests

View File

@ -25,6 +25,16 @@ class APIClient {
public static $PUT = "PUT"; public static $PUT = "PUT";
public static $DELETE = "DELETE"; public static $DELETE = "DELETE";
/*
* @var string timeout (second) of the HTTP request, by default set to 0, no timeout
*/
protected $curl_timeout = 0;
/*
* @var string user agent of the HTTP request, set to "PHP-Swagger" by default
*/
protected $user_agent = "PHP-Swagger";
/** /**
* @param string $host the address of the API server * @param string $host the address of the API server
* @param string $headerName a header to pass on requests * @param string $headerName a header to pass on requests
@ -54,7 +64,7 @@ class APIClient {
if (!is_numeric($seconds)) { if (!is_numeric($seconds)) {
throw new Exception('Timeout variable must be numeric.'); throw new Exception('Timeout variable must be numeric.');
} }
$this->curl_timout = $seconds; $this->curl_timeout = $seconds;
} }
/** /**
@ -84,15 +94,16 @@ class APIClient {
$headers[] = $this->headerName . ": " . $this->headerValue; $headers[] = $this->headerName . ": " . $this->headerValue;
} }
if (strpos($headers['Content-Type'], "multipart/form-data") < 0 and (is_object($postData) or is_array($postData))) { if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) {
$postData = json_encode($this->sanitizeForSerialization($postData)); $postData = json_encode($this->sanitizeForSerialization($postData));
} }
$url = $this->host . $resourcePath; $url = $this->host . $resourcePath;
$curl = curl_init(); $curl = curl_init();
if ($this->curl_timout) { // set timeout, if needed
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timout); if ($this->curl_timeout != 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timeout);
} }
// return the result on success, rather than just TRUE // return the result on success, rather than just TRUE
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@ -120,11 +131,7 @@ class APIClient {
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
// Set user agent // Set user agent
if ($this->user_agent) { curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
} else { // use PHP-Swagger as the default user agent
curl_setopt($curl, CURLOPT_USERAGENT, 'PHP-Swagger');
}
// Make the request // Make the request
$response = curl_exec($curl); $response = curl_exec($curl);

View File

@ -43,6 +43,7 @@ class PetApi {
$resourcePath = "/pet"; $resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT"; $method = "PUT";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -63,16 +64,19 @@ class PetApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -92,6 +96,7 @@ class PetApi {
$resourcePath = "/pet"; $resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -112,16 +117,19 @@ class PetApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -141,6 +149,7 @@ class PetApi {
$resourcePath = "/pet/findByStatus"; $resourcePath = "/pet/findByStatus";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -160,16 +169,19 @@ class PetApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -195,6 +207,7 @@ class PetApi {
$resourcePath = "/pet/findByTags"; $resourcePath = "/pet/findByTags";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -214,16 +227,19 @@ class PetApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -249,6 +265,7 @@ class PetApi {
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -269,16 +286,19 @@ class PetApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -306,6 +326,7 @@ class PetApi {
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -332,16 +353,19 @@ class PetApi {
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -362,6 +386,7 @@ class PetApi {
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE"; $method = "DELETE";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -385,16 +410,19 @@ class PetApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -416,6 +444,7 @@ class PetApi {
$resourcePath = "/pet/{petId}/uploadImage"; $resourcePath = "/pet/{petId}/uploadImage";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -442,16 +471,19 @@ class PetApi {
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);

View File

@ -42,6 +42,7 @@ class StoreApi {
$resourcePath = "/store/inventory"; $resourcePath = "/store/inventory";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -58,16 +59,19 @@ class StoreApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -93,6 +97,7 @@ class StoreApi {
$resourcePath = "/store/order"; $resourcePath = "/store/order";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -113,16 +118,19 @@ class StoreApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -148,6 +156,7 @@ class StoreApi {
$resourcePath = "/store/order/{orderId}"; $resourcePath = "/store/order/{orderId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -168,16 +177,19 @@ class StoreApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -203,6 +215,7 @@ class StoreApi {
$resourcePath = "/store/order/{orderId}"; $resourcePath = "/store/order/{orderId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE"; $method = "DELETE";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -223,16 +236,19 @@ class StoreApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);

View File

@ -43,6 +43,7 @@ class UserApi {
$resourcePath = "/user"; $resourcePath = "/user";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -63,16 +64,19 @@ class UserApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -92,6 +96,7 @@ class UserApi {
$resourcePath = "/user/createWithArray"; $resourcePath = "/user/createWithArray";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -112,16 +117,19 @@ class UserApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -141,6 +149,7 @@ class UserApi {
$resourcePath = "/user/createWithList"; $resourcePath = "/user/createWithList";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -161,16 +170,19 @@ class UserApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -191,6 +203,7 @@ class UserApi {
$resourcePath = "/user/login"; $resourcePath = "/user/login";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -213,16 +226,19 @@ class UserApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -247,6 +263,7 @@ class UserApi {
$resourcePath = "/user/logout"; $resourcePath = "/user/logout";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -263,16 +280,19 @@ class UserApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -292,6 +312,7 @@ class UserApi {
$resourcePath = "/user/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -312,16 +333,19 @@ class UserApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -348,6 +372,7 @@ class UserApi {
$resourcePath = "/user/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT"; $method = "PUT";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -372,16 +397,19 @@ class UserApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -401,6 +429,7 @@ class UserApi {
$resourcePath = "/user/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE"; $method = "DELETE";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -421,16 +450,19 @@ class UserApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* testing category description *
* *
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. * NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
* *

View File

@ -0,0 +1,19 @@
<?php
require_once('SwaggerPetstore.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);
// return Pet (model)
$response = $pet_api->getPetById($petId);
$this->assertSame($response->id, $petId);
}
}
?>

View File

@ -31,13 +31,13 @@ class Order(object):
'id': 'long', 'id': 'long',
'petId': 'long', 'pet_id': 'long',
'quantity': 'int', 'quantity': 'int',
'shipDate': 'DateTime', 'ship_date': 'DateTime',
'status': 'str', 'status': 'str',
@ -51,11 +51,11 @@ class Order(object):
'id': 'id', 'id': 'id',
'petId': 'petId', 'pet_id': 'petId',
'quantity': 'quantity', 'quantity': 'quantity',
'shipDate': 'shipDate', 'ship_date': 'shipDate',
'status': 'status', 'status': 'status',
@ -68,13 +68,13 @@ class Order(object):
self.id = None # long self.id = None # long
self.petId = None # long self.pet_id = None # long
self.quantity = None # int self.quantity = None # int
self.shipDate = None # DateTime self.ship_date = None # DateTime
#Order Status #Order Status

View File

@ -37,7 +37,7 @@ class Pet(object):
'name': 'str', 'name': 'str',
'photoUrls': 'list[str]', 'photo_urls': 'list[str]',
'tags': 'list[Tag]', 'tags': 'list[Tag]',
@ -55,7 +55,7 @@ class Pet(object):
'name': 'name', 'name': 'name',
'photoUrls': 'photoUrls', 'photo_urls': 'photoUrls',
'tags': 'tags', 'tags': 'tags',
@ -74,7 +74,7 @@ class Pet(object):
self.name = None # str self.name = None # str
self.photoUrls = None # list[str] self.photo_urls = None # list[str]
self.tags = None # list[Tag] self.tags = None # list[Tag]

View File

@ -34,10 +34,10 @@ class User(object):
'username': 'str', 'username': 'str',
'firstName': 'str', 'first_name': 'str',
'lastName': 'str', 'last_name': 'str',
'email': 'str', 'email': 'str',
@ -49,7 +49,7 @@ class User(object):
'phone': 'str', 'phone': 'str',
'userStatus': 'int' 'user_status': 'int'
} }
@ -59,9 +59,9 @@ class User(object):
'username': 'username', 'username': 'username',
'firstName': 'firstName', 'first_name': 'firstName',
'lastName': 'lastName', 'last_name': 'lastName',
'email': 'email', 'email': 'email',
@ -69,7 +69,7 @@ class User(object):
'phone': 'phone', 'phone': 'phone',
'userStatus': 'userStatus' 'user_status': 'userStatus'
} }
@ -81,10 +81,10 @@ class User(object):
self.username = None # str self.username = None # str
self.firstName = None # str self.first_name = None # str
self.lastName = None # str self.last_name = None # str
self.email = None # str self.email = None # str
@ -97,5 +97,5 @@ class User(object):
#User Status #User Status
self.userStatus = None # int self.user_status = None # int

View File

@ -272,14 +272,14 @@ class PetApi(object):
Args: Args:
petId, long: ID of pet that needs to be fetched (required) pet_id, long: ID of pet that needs to be fetched (required)
Returns: Pet Returns: Pet
""" """
allParams = ['petId'] allParams = ['pet_id']
params = locals() params = locals()
for (key, val) in params['kwargs'].iteritems(): for (key, val) in params['kwargs'].iteritems():
@ -306,8 +306,8 @@ class PetApi(object):
if ('petId' in params): if ('pet_id' in params):
replacement = str(self.apiClient.toPathValue(params['petId'])) replacement = str(self.apiClient.toPathValue(params['pet_id']))
replacement = urllib.quote(replacement) replacement = urllib.quote(replacement)
resourcePath = resourcePath.replace('{' + 'petId' + '}', resourcePath = resourcePath.replace('{' + 'petId' + '}',
replacement) replacement)
@ -337,7 +337,7 @@ class PetApi(object):
Args: Args:
petId, str: ID of pet that needs to be updated (required) pet_id, str: ID of pet that needs to be updated (required)
name, str: Updated name of the pet (required) name, str: Updated name of the pet (required)
@ -350,7 +350,7 @@ class PetApi(object):
Returns: Returns:
""" """
allParams = ['petId', 'name', 'status'] allParams = ['pet_id', 'name', 'status']
params = locals() params = locals()
for (key, val) in params['kwargs'].iteritems(): for (key, val) in params['kwargs'].iteritems():
@ -377,8 +377,8 @@ class PetApi(object):
if ('petId' in params): if ('pet_id' in params):
replacement = str(self.apiClient.toPathValue(params['petId'])) replacement = str(self.apiClient.toPathValue(params['pet_id']))
replacement = urllib.quote(replacement) replacement = urllib.quote(replacement)
resourcePath = resourcePath.replace('{' + 'petId' + '}', resourcePath = resourcePath.replace('{' + 'petId' + '}',
replacement) replacement)
@ -411,14 +411,14 @@ class PetApi(object):
api_key, str: (required) api_key, str: (required)
petId, long: Pet id to delete (required) pet_id, long: Pet id to delete (required)
Returns: Returns:
""" """
allParams = ['api_key', 'petId'] allParams = ['api_key', 'pet_id']
params = locals() params = locals()
for (key, val) in params['kwargs'].iteritems(): for (key, val) in params['kwargs'].iteritems():
@ -448,8 +448,8 @@ class PetApi(object):
if ('petId' in params): if ('pet_id' in params):
replacement = str(self.apiClient.toPathValue(params['petId'])) replacement = str(self.apiClient.toPathValue(params['pet_id']))
replacement = urllib.quote(replacement) replacement = urllib.quote(replacement)
resourcePath = resourcePath.replace('{' + 'petId' + '}', resourcePath = resourcePath.replace('{' + 'petId' + '}',
replacement) replacement)
@ -473,10 +473,10 @@ class PetApi(object):
Args: Args:
petId, long: ID of pet to update (required) pet_id, long: ID of pet to update (required)
additionalMetadata, str: Additional data to pass to server (required) additional_metadata, str: Additional data to pass to server (required)
file, file: file to upload (required) file, file: file to upload (required)
@ -486,7 +486,7 @@ class PetApi(object):
Returns: Returns:
""" """
allParams = ['petId', 'additionalMetadata', 'file'] allParams = ['pet_id', 'additional_metadata', 'file']
params = locals() params = locals()
for (key, val) in params['kwargs'].iteritems(): for (key, val) in params['kwargs'].iteritems():
@ -513,16 +513,16 @@ class PetApi(object):
if ('petId' in params): if ('pet_id' in params):
replacement = str(self.apiClient.toPathValue(params['petId'])) replacement = str(self.apiClient.toPathValue(params['pet_id']))
replacement = urllib.quote(replacement) replacement = urllib.quote(replacement)
resourcePath = resourcePath.replace('{' + 'petId' + '}', resourcePath = resourcePath.replace('{' + 'petId' + '}',
replacement) replacement)
if ('additionalMetadata' in params): if ('additional_metadata' in params):
formParams['additionalMetadata'] = params['additionalMetadata'] formParams['additionalMetadata'] = params['additional_metadata']
if ('file' in params): if ('file' in params):
files['file'] = params['file'] files['file'] = params['file']

View File

@ -154,14 +154,14 @@ class StoreApi(object):
Args: Args:
orderId, str: ID of pet that needs to be fetched (required) order_id, str: ID of pet that needs to be fetched (required)
Returns: Order Returns: Order
""" """
allParams = ['orderId'] allParams = ['order_id']
params = locals() params = locals()
for (key, val) in params['kwargs'].iteritems(): for (key, val) in params['kwargs'].iteritems():
@ -188,8 +188,8 @@ class StoreApi(object):
if ('orderId' in params): if ('order_id' in params):
replacement = str(self.apiClient.toPathValue(params['orderId'])) replacement = str(self.apiClient.toPathValue(params['order_id']))
replacement = urllib.quote(replacement) replacement = urllib.quote(replacement)
resourcePath = resourcePath.replace('{' + 'orderId' + '}', resourcePath = resourcePath.replace('{' + 'orderId' + '}',
replacement) replacement)
@ -219,14 +219,14 @@ class StoreApi(object):
Args: Args:
orderId, str: ID of the order that needs to be deleted (required) order_id, str: ID of the order that needs to be deleted (required)
Returns: Returns:
""" """
allParams = ['orderId'] allParams = ['order_id']
params = locals() params = locals()
for (key, val) in params['kwargs'].iteritems(): for (key, val) in params['kwargs'].iteritems():
@ -253,8 +253,8 @@ class StoreApi(object):
if ('orderId' in params): if ('order_id' in params):
replacement = str(self.apiClient.toPathValue(params['orderId'])) replacement = str(self.apiClient.toPathValue(params['order_id']))
replacement = urllib.quote(replacement) replacement = urllib.quote(replacement)
resourcePath = resourcePath.replace('{' + 'orderId' + '}', resourcePath = resourcePath.replace('{' + 'orderId' + '}',
replacement) replacement)

View File

@ -129,7 +129,7 @@
</repository> </repository>
</repositories> </repositories>
<properties> <properties>
<swagger-core-version>1.5.0-M2</swagger-core-version> <swagger-core-version>2.1.1-M2-SNAPSHOT</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version> <jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version> <jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version> <slf4j-version>1.6.3</slf4j-version>