fix swift mapping with int and number

This commit is contained in:
wing328
2016-04-11 19:37:56 +08:00
parent 6c7efd502b
commit 44a4219e3e
120 changed files with 1291 additions and 1723 deletions

View File

@@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-04-09T21:05:22.902+02:00
- Build date: 2016-04-11T16:59:06.544+08:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
## Requirements
@@ -127,25 +127,10 @@ Class | Method | HTTP request | Description
## Documentation For Authorization
## petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## test_api_client_id
## test_api_key_header
- **Type**: API key
- **API key parameter name**: x-test_api_client_id
- **Location**: HTTP header
## test_api_client_secret
- **Type**: API key
- **API key parameter name**: x-test_api_client_secret
- **API key parameter name**: test_api_key_header
- **Location**: HTTP header
## api_key
@@ -158,17 +143,32 @@ Class | Method | HTTP request | Description
- **Type**: HTTP basic authentication
## test_api_client_secret
- **Type**: API key
- **API key parameter name**: x-test_api_client_secret
- **Location**: HTTP header
## test_api_client_id
- **Type**: API key
- **API key parameter name**: x-test_api_client_id
- **Location**: HTTP header
## test_api_key_query
- **Type**: API key
- **API key parameter name**: test_api_key_query
- **Location**: URL query string
## test_api_key_header
## petstore_auth
- **Type**: API key
- **API key parameter name**: test_api_key_header
- **Location**: HTTP header
- **Type**: OAuth
- **Flow**: implicit
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## Author

View File

@@ -3,12 +3,12 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**photo_urls** | **string[]** | | [optional]
**name** | **string** | | [optional]
**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional]
**id** | **int** | |
**category** | **object** | | [optional]
**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional]
**status** | **string** | pet status in the store | [optional]
**name** | **string** | | [optional]
**photo_urls** | **string[]** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -268,12 +268,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
// Configure API key authorization: api_key
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi();
$pet_id = 789; // int | ID of pet that needs to be fetched
@@ -299,7 +299,7 @@ Name | Type | Description | Notes
### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
@@ -320,12 +320,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
// Configure API key authorization: api_key
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi();
$pet_id = 789; // int | ID of pet that needs to be fetched
@@ -351,7 +351,7 @@ Name | Type | Description | Notes
### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
@@ -372,12 +372,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
// Configure API key authorization: api_key
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi();
$pet_id = 789; // int | ID of pet that needs to be fetched
@@ -403,7 +403,7 @@ Name | Type | Description | Notes
### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers

View File

@@ -214,14 +214,14 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: test_api_key_query
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_query', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_query', 'BEARER');
// Configure API key authorization: test_api_key_header
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_header', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_header', 'BEARER');
// Configure API key authorization: test_api_key_query
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_query', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_query', 'BEARER');
$api_instance = new Swagger\Client\Api\StoreApi();
$order_id = "order_id_example"; // string | ID of pet that needs to be fetched
@@ -247,7 +247,7 @@ Name | Type | Description | Notes
### Authorization
[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header)
[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
### HTTP reuqest headers

View File

@@ -593,17 +593,17 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) {
$headerParams['api_key'] = $apiKey;
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
@@ -695,17 +695,17 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) {
$headerParams['api_key'] = $apiKey;
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
@@ -797,17 +797,17 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) {
$headerParams['api_key'] = $apiKey;
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(

View File

@@ -506,16 +506,16 @@ class StoreApi
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query');
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header');
if (strlen($apiKey) !== 0) {
$queryParams['test_api_key_query'] = $apiKey;
$headerParams['test_api_key_header'] = $apiKey;
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header');
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query');
if (strlen($apiKey) !== 0) {
$headerParams['test_api_key_header'] = $apiKey;
$queryParams['test_api_key_query'] = $apiKey;
}
// make the API Call

View File

@@ -57,12 +57,12 @@ class InlineResponse200 implements ArrayAccess
* @var string[]
*/
static $swaggerTypes = array(
'photo_urls' => 'string[]',
'name' => 'string',
'tags' => '\Swagger\Client\Model\Tag[]',
'id' => 'int',
'category' => 'object',
'tags' => '\Swagger\Client\Model\Tag[]',
'status' => 'string'
'status' => 'string',
'name' => 'string',
'photo_urls' => 'string[]'
);
static function swaggerTypes() {
@@ -74,12 +74,12 @@ class InlineResponse200 implements ArrayAccess
* @var string[]
*/
static $attributeMap = array(
'photo_urls' => 'photoUrls',
'name' => 'name',
'tags' => 'tags',
'id' => 'id',
'category' => 'category',
'tags' => 'tags',
'status' => 'status'
'status' => 'status',
'name' => 'name',
'photo_urls' => 'photoUrls'
);
static function attributeMap() {
@@ -91,12 +91,12 @@ class InlineResponse200 implements ArrayAccess
* @var string[]
*/
static $setters = array(
'photo_urls' => 'setPhotoUrls',
'name' => 'setName',
'tags' => 'setTags',
'id' => 'setId',
'category' => 'setCategory',
'tags' => 'setTags',
'status' => 'setStatus'
'status' => 'setStatus',
'name' => 'setName',
'photo_urls' => 'setPhotoUrls'
);
static function setters() {
@@ -108,12 +108,12 @@ class InlineResponse200 implements ArrayAccess
* @var string[]
*/
static $getters = array(
'photo_urls' => 'getPhotoUrls',
'name' => 'getName',
'tags' => 'getTags',
'id' => 'getId',
'category' => 'getCategory',
'tags' => 'getTags',
'status' => 'getStatus'
'status' => 'getStatus',
'name' => 'getName',
'photo_urls' => 'getPhotoUrls'
);
static function getters() {
@@ -121,15 +121,10 @@ class InlineResponse200 implements ArrayAccess
}
/**
* $photo_urls
* @var string[]
* $tags
* @var \Swagger\Client\Model\Tag[]
*/
protected $photo_urls;
/**
* $name
* @var string
*/
protected $name;
protected $tags;
/**
* $id
* @var int
@@ -140,16 +135,21 @@ class InlineResponse200 implements ArrayAccess
* @var object
*/
protected $category;
/**
* $tags
* @var \Swagger\Client\Model\Tag[]
*/
protected $tags;
/**
* $status pet status in the store
* @var string
*/
protected $status;
/**
* $name
* @var string
*/
protected $name;
/**
* $photo_urls
* @var string[]
*/
protected $photo_urls;
/**
* Constructor
@@ -160,52 +160,32 @@ class InlineResponse200 implements ArrayAccess
if ($data != null) {
$this->photo_urls = $data["photo_urls"];
$this->name = $data["name"];
$this->tags = $data["tags"];
$this->id = $data["id"];
$this->category = $data["category"];
$this->tags = $data["tags"];
$this->status = $data["status"];
$this->name = $data["name"];
$this->photo_urls = $data["photo_urls"];
}
}
/**
* Gets photo_urls
* @return string[]
* Gets tags
* @return \Swagger\Client\Model\Tag[]
*/
public function getPhotoUrls()
public function getTags()
{
return $this->photo_urls;
return $this->tags;
}
/**
* Sets photo_urls
* @param string[] $photo_urls
* Sets tags
* @param \Swagger\Client\Model\Tag[] $tags
* @return $this
*/
public function setPhotoUrls($photo_urls)
public function setTags($tags)
{
$this->photo_urls = $photo_urls;
return $this;
}
/**
* Gets name
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Sets name
* @param string $name
* @return $this
*/
public function setName($name)
{
$this->name = $name;
$this->tags = $tags;
return $this;
}
/**
@@ -248,26 +228,6 @@ class InlineResponse200 implements ArrayAccess
$this->category = $category;
return $this;
}
/**
* Gets tags
* @return \Swagger\Client\Model\Tag[]
*/
public function getTags()
{
return $this->tags;
}
/**
* Sets tags
* @param \Swagger\Client\Model\Tag[] $tags
* @return $this
*/
public function setTags($tags)
{
$this->tags = $tags;
return $this;
}
/**
* Gets status
* @return string
@@ -291,6 +251,46 @@ class InlineResponse200 implements ArrayAccess
$this->status = $status;
return $this;
}
/**
* Gets name
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Sets name
* @param string $name
* @return $this
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Gets photo_urls
* @return string[]
*/
public function getPhotoUrls()
{
return $this->photo_urls;
}
/**
* Sets photo_urls
* @param string[] $photo_urls
* @return $this
*/
public function setPhotoUrls($photo_urls)
{
$this->photo_urls = $photo_urls;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
* @param integer $offset Offset

View File

@@ -256,7 +256,7 @@ class ObjectSerializer
} else {
return null;
}
} elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
settype($data, $class);
return $data;
} elseif ($class === '\SplFileObject') {