From 7d6ac316198c1837fbe1da12c577231499b79789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Wed, 29 Jun 2016 23:32:02 +0200 Subject: [PATCH 1/2] [PHP] Add path without expanded path parameters to callApi In continuation of #3117 it could be useful to know the path of an endpoint (without path parameters expanded) in the `callApi` method of `ApiClient`. This is for use cases where you would create a derived class from `ApiClient` for manipulating responses from the server before further processing (#3117) or add extended logging of the API calls. --- .../src/main/resources/php/ApiClient.mustache | 3 ++- .../src/main/resources/php/api.mustache | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache index 98a6ad5df8c..5b21f922c6b 100644 --- a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache @@ -123,11 +123,12 @@ class ApiClient * @param array $postData parameters to be placed in POST body * @param array $headerParams parameters to be place in request header * @param string $responseType expected response type of the endpoint + * @param string $endpointPath path to method endpoint before expanding parameters * * @throws \{{invokerPackage}}\ApiException on a non 2xx response * @return mixed */ - public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null) + public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) { $headers = array(); diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 85bc71d2dad..dfc079874e9 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -266,8 +266,14 @@ use \{{invokerPackage}}\ObjectSerializer; '{{httpMethod}}', $queryParams, $httpBody, - $headerParams{{#returnType}}, - '{{returnType}}'{{/returnType}} + $headerParams, + {{#returnType}} + '{{returnType}}', + {{/returnType}} + {{^returnType}} + null, + {{/returnType}} + '{{path}}' ); {{#returnType}} From a4ec29000afa7eee036d80ccb38d7ff0482980ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Wed, 29 Jun 2016 23:38:04 +0200 Subject: [PATCH 2/2] [PHP] Regenerate petstore samples --- .../php/SwaggerClient-php/README.md | 16 +++--- .../php/SwaggerClient-php/docs/Api/FakeApi.md | 2 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 6 +- .../php/SwaggerClient-php/lib/ApiClient.php | 3 +- .../SwaggerClient-php/lib/Configuration.php | 2 +- .../lib/ObjectSerializer.php | 2 +- .../petstore/php/SwaggerClient-php/README.md | 14 ++--- .../SwaggerClient-php/docs/Model/ArrayTest.md | 1 - .../SwaggerClient-php/docs/Model/MapTest.md | 1 - .../php/SwaggerClient-php/lib/Api/FakeApi.php | 12 +++- .../php/SwaggerClient-php/lib/Api/PetApi.php | 28 ++++++--- .../SwaggerClient-php/lib/Api/StoreApi.php | 13 +++-- .../php/SwaggerClient-php/lib/Api/UserApi.php | 30 +++++++--- .../php/SwaggerClient-php/lib/ApiClient.php | 3 +- .../SwaggerClient-php/lib/Model/ArrayTest.php | 57 ++----------------- .../SwaggerClient-php/lib/Model/MapTest.php | 49 ---------------- .../lib/ObjectSerializer.php | 2 +- 17 files changed, 91 insertions(+), 150 deletions(-) diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/README.md b/samples/client/petstore-security-test/php/SwaggerClient-php/README.md index 5fb6f05595b..069a30dae03 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/README.md +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/README.md @@ -4,7 +4,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 ' \" =end -- Build date: 2016-06-28T12:21:23.533+08:00 +- Build date: 2016-06-30T07:09:53.488+02:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -71,7 +71,7 @@ try { ## Documentation for API Endpoints -All URIs are relative to *https://petstore.swagger.io */ ' " =end/v2 */ ' " =end* +All URIs are relative to *https://petstore.swagger.io ' \" =end/v2 ' \" =end* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- @@ -86,12 +86,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key */ ' " =end -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -101,6 +95,12 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account */ ' " =end - **read:pets**: read your pets */ ' " =end +## api_key + +- **Type**: API key +- **API key parameter name**: api_key */ ' " =end +- **Location**: HTTP header + ## Author diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/docs/Api/FakeApi.md b/samples/client/petstore-security-test/php/SwaggerClient-php/docs/Api/FakeApi.md index 4bc0c9d8572..ae10582a7b4 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/docs/Api/FakeApi.md @@ -1,6 +1,6 @@ # Swagger\Client\FakeApi -All URIs are relative to *https://petstore.swagger.io */ ' " =end/v2 */ ' " =end* +All URIs are relative to *https://petstore.swagger.io ' \" =end/v2 ' \" =end* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php index 1fdfa12168a..a74ebc4af68 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -73,7 +73,7 @@ class FakeApi { if ($apiClient == null) { $apiClient = new ApiClient(); - $apiClient->getConfig()->setHost('https://petstore.swagger.io */ ' " =end/v2 */ ' " =end'); + $apiClient->getConfig()->setHost('https://petstore.swagger.io ' \" =end/v2 ' \" =end'); } $this->apiClient = $apiClient; @@ -161,7 +161,9 @@ class FakeApi 'PUT', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/fake' ); return array(null, $statusCode, $httpHeader); diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiClient.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiClient.php index a2fc34149c5..c29bfb86bb2 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiClient.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiClient.php @@ -144,11 +144,12 @@ class ApiClient * @param array $postData parameters to be placed in POST body * @param array $headerParams parameters to be place in request header * @param string $responseType expected response type of the endpoint + * @param string $endpointPath path to method endpoint before expanding parameters * * @throws \Swagger\Client\ApiException on a non 2xx response * @return mixed */ - public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null) + public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) { $headers = array(); diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Configuration.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Configuration.php index 990872ad675..3308e3c5824 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Configuration.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Configuration.php @@ -102,7 +102,7 @@ class Configuration * * @var string */ - protected $host = 'https://petstore.swagger.io */ ' " =end/v2 */ ' " =end'; + protected $host = 'https://petstore.swagger.io ' \" =end/v2 ' \" =end'; /** * Timeout (second) of the HTTP request, by default set to 0, no timeout diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ObjectSerializer.php index 9a73d2d5e3b..ca518c99c8b 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -264,7 +264,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { + } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index b0698cf96af..735d53925ae 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -4,7 +4,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 -- Build date: 2016-06-28T14:37:09.979+08:00 +- Build date: 2016-06-30T07:09:58.112+02:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -133,12 +133,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -148,6 +142,12 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Author diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Model/ArrayTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/ArrayTest.md index 0f7f3a44e9e..f982dc2e4c7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Model/ArrayTest.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Model/ArrayTest.md @@ -6,7 +6,6 @@ Name | Type | Description | Notes **array_of_string** | **string[]** | | [optional] **array_array_of_integer** | [**int[][]**](array.md) | | [optional] **array_array_of_model** | [**\Swagger\Client\Model\ReadOnlyFirst[][]**](array.md) | | [optional] -**array_of_enum** | **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) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Model/MapTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/MapTest.md index 731d6bd1de4..e2781ccc398 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Model/MapTest.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Model/MapTest.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **map_map_of_string** | [**map[string,map[string,string]]**](map.md) | | [optional] -**map_map_of_enum** | [**map[string,map[string,string]]**](map.md) | | [optional] **map_of_enum_string** | **map[string,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) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index d6d7dce02e9..4c1c1c04ed2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -161,7 +161,9 @@ class FakeApi 'PUT', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/fake' ); return array(null, $statusCode, $httpHeader); @@ -357,7 +359,9 @@ class FakeApi 'POST', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/fake' ); return array(null, $statusCode, $httpHeader); @@ -440,7 +444,9 @@ class FakeApi 'GET', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/fake' ); return array(null, $statusCode, $httpHeader); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 5e233c03f3d..98ebca4f6dd 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -170,7 +170,9 @@ class PetApi 'POST', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/pet' ); return array(null, $statusCode, $httpHeader); @@ -259,7 +261,9 @@ class PetApi 'DELETE', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/pet/{petId}' ); return array(null, $statusCode, $httpHeader); @@ -342,7 +346,8 @@ class PetApi $queryParams, $httpBody, $headerParams, - '\Swagger\Client\Model\Pet[]' + '\Swagger\Client\Model\Pet[]', + '/pet/findByStatus' ); return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader); @@ -429,7 +434,8 @@ class PetApi $queryParams, $httpBody, $headerParams, - '\Swagger\Client\Model\Pet[]' + '\Swagger\Client\Model\Pet[]', + '/pet/findByTags' ); return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader); @@ -518,7 +524,8 @@ class PetApi $queryParams, $httpBody, $headerParams, - '\Swagger\Client\Model\Pet' + '\Swagger\Client\Model\Pet', + '/pet/{petId}' ); return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader); @@ -602,7 +609,9 @@ class PetApi 'PUT', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/pet' ); return array(null, $statusCode, $httpHeader); @@ -697,7 +706,9 @@ class PetApi 'POST', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/pet/{petId}' ); return array(null, $statusCode, $httpHeader); @@ -799,7 +810,8 @@ class PetApi $queryParams, $httpBody, $headerParams, - '\Swagger\Client\Model\ApiResponse' + '\Swagger\Client\Model\ApiResponse', + '/pet/{petId}/uploadImage' ); return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\ApiResponse', $httpHeader), $statusCode, $httpHeader); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 9b6ec200473..6f8bf19eb24 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -173,7 +173,9 @@ class StoreApi 'DELETE', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/store/order/{orderId}' ); return array(null, $statusCode, $httpHeader); @@ -244,7 +246,8 @@ class StoreApi $queryParams, $httpBody, $headerParams, - 'map[string,int]' + 'map[string,int]', + '/store/inventory' ); return array($this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader); @@ -335,7 +338,8 @@ class StoreApi $queryParams, $httpBody, $headerParams, - '\Swagger\Client\Model\Order' + '\Swagger\Client\Model\Order', + '/store/order/{orderId}' ); return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader); @@ -416,7 +420,8 @@ class StoreApi $queryParams, $httpBody, $headerParams, - '\Swagger\Client\Model\Order' + '\Swagger\Client\Model\Order', + '/store/order' ); return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index fd6f3f1d390..ac046ad5086 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -166,7 +166,9 @@ class UserApi 'POST', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/user' ); return array(null, $statusCode, $httpHeader); @@ -242,7 +244,9 @@ class UserApi 'POST', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/user/createWithArray' ); return array(null, $statusCode, $httpHeader); @@ -318,7 +322,9 @@ class UserApi 'POST', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/user/createWithList' ); return array(null, $statusCode, $httpHeader); @@ -397,7 +403,9 @@ class UserApi 'DELETE', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/user/{username}' ); return array(null, $statusCode, $httpHeader); @@ -477,7 +485,8 @@ class UserApi $queryParams, $httpBody, $headerParams, - '\Swagger\Client\Model\User' + '\Swagger\Client\Model\User', + '/user/{username}' ); return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader); @@ -567,7 +576,8 @@ class UserApi $queryParams, $httpBody, $headerParams, - 'string' + 'string', + '/user/login' ); return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader); @@ -636,7 +646,9 @@ class UserApi 'GET', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/user/logout' ); return array(null, $statusCode, $httpHeader); @@ -726,7 +738,9 @@ class UserApi 'PUT', $queryParams, $httpBody, - $headerParams + $headerParams, + null, + '/user/{username}' ); return array(null, $statusCode, $httpHeader); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php index 02fb8729620..45feec1a287 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php @@ -144,11 +144,12 @@ class ApiClient * @param array $postData parameters to be placed in POST body * @param array $headerParams parameters to be place in request header * @param string $responseType expected response type of the endpoint + * @param string $endpointPath path to method endpoint before expanding parameters * * @throws \Swagger\Client\ApiException on a non 2xx response * @return mixed */ - public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null) + public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) { $headers = array(); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayTest.php index 3a8e201ac55..5e8f450368a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ArrayTest.php @@ -68,8 +68,7 @@ class ArrayTest implements ArrayAccess protected static $swaggerTypes = array( 'array_of_string' => 'string[]', 'array_array_of_integer' => 'int[][]', - 'array_array_of_model' => '\Swagger\Client\Model\ReadOnlyFirst[][]', - 'array_of_enum' => 'string[]' + 'array_array_of_model' => '\Swagger\Client\Model\ReadOnlyFirst[][]' ); public static function swaggerTypes() @@ -84,8 +83,7 @@ class ArrayTest implements ArrayAccess protected static $attributeMap = array( 'array_of_string' => 'array_of_string', 'array_array_of_integer' => 'array_array_of_integer', - 'array_array_of_model' => 'array_array_of_model', - 'array_of_enum' => 'array_of_enum' + 'array_array_of_model' => 'array_array_of_model' ); public static function attributeMap() @@ -100,8 +98,7 @@ class ArrayTest implements ArrayAccess protected static $setters = array( 'array_of_string' => 'setArrayOfString', 'array_array_of_integer' => 'setArrayArrayOfInteger', - 'array_array_of_model' => 'setArrayArrayOfModel', - 'array_of_enum' => 'setArrayOfEnum' + 'array_array_of_model' => 'setArrayArrayOfModel' ); public static function setters() @@ -116,8 +113,7 @@ class ArrayTest implements ArrayAccess protected static $getters = array( 'array_of_string' => 'getArrayOfString', 'array_array_of_integer' => 'getArrayArrayOfInteger', - 'array_array_of_model' => 'getArrayArrayOfModel', - 'array_of_enum' => 'getArrayOfEnum' + 'array_array_of_model' => 'getArrayArrayOfModel' ); public static function getters() @@ -128,17 +124,6 @@ class ArrayTest implements ArrayAccess - /** - * Gets allowable values of the enum - * @return string[] - */ - public function getArrayOfEnumAllowableValues() - { - return [ - - ]; - } - /** * Associative array for storing property values @@ -155,7 +140,6 @@ class ArrayTest implements ArrayAccess $this->container['array_of_string'] = isset($data['array_of_string']) ? $data['array_of_string'] : null; $this->container['array_array_of_integer'] = isset($data['array_array_of_integer']) ? $data['array_array_of_integer'] : null; $this->container['array_array_of_model'] = isset($data['array_array_of_model']) ? $data['array_array_of_model'] : null; - $this->container['array_of_enum'] = isset($data['array_of_enum']) ? $data['array_of_enum'] : null; } /** @@ -166,10 +150,6 @@ class ArrayTest implements ArrayAccess public function listInvalidProperties() { $invalid_properties = array(); - $allowed_values = array(); - if (!in_array($this->container['array_of_enum'], $allowed_values)) { - $invalid_properties[] = "invalid value for 'array_of_enum', must be one of #{allowed_values}."; - } return $invalid_properties; } @@ -181,10 +161,6 @@ class ArrayTest implements ArrayAccess */ public function valid() { - $allowed_values = array(); - if (!in_array($this->container['array_of_enum'], $allowed_values)) { - return false; - } return true; } @@ -251,31 +227,6 @@ class ArrayTest implements ArrayAccess return $this; } - - /** - * Gets array_of_enum - * @return string[] - */ - public function getArrayOfEnum() - { - return $this->container['array_of_enum']; - } - - /** - * Sets array_of_enum - * @param string[] $array_of_enum - * @return $this - */ - public function setArrayOfEnum($array_of_enum) - { - $allowed_values = array(); - if (!in_array($array_of_enum, $allowed_values)) { - throw new \InvalidArgumentException("Invalid value for 'array_of_enum', must be one of "); - } - $this->container['array_of_enum'] = $array_of_enum; - - return $this; - } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php index 24484b9bb76..dff8b6cbb62 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php @@ -67,7 +67,6 @@ class MapTest implements ArrayAccess */ protected static $swaggerTypes = array( 'map_map_of_string' => 'map[string,map[string,string]]', - 'map_map_of_enum' => 'map[string,map[string,string]]', 'map_of_enum_string' => 'map[string,string]' ); @@ -82,7 +81,6 @@ class MapTest implements ArrayAccess */ protected static $attributeMap = array( 'map_map_of_string' => 'map_map_of_string', - 'map_map_of_enum' => 'map_map_of_enum', 'map_of_enum_string' => 'map_of_enum_string' ); @@ -97,7 +95,6 @@ class MapTest implements ArrayAccess */ protected static $setters = array( 'map_map_of_string' => 'setMapMapOfString', - 'map_map_of_enum' => 'setMapMapOfEnum', 'map_of_enum_string' => 'setMapOfEnumString' ); @@ -112,7 +109,6 @@ class MapTest implements ArrayAccess */ protected static $getters = array( 'map_map_of_string' => 'getMapMapOfString', - 'map_map_of_enum' => 'getMapMapOfEnum', 'map_of_enum_string' => 'getMapOfEnumString' ); @@ -124,17 +120,6 @@ class MapTest implements ArrayAccess - /** - * Gets allowable values of the enum - * @return string[] - */ - public function getMapMapOfEnumAllowableValues() - { - return [ - - ]; - } - /** * Gets allowable values of the enum * @return string[] @@ -160,7 +145,6 @@ class MapTest implements ArrayAccess public function __construct(array $data = null) { $this->container['map_map_of_string'] = isset($data['map_map_of_string']) ? $data['map_map_of_string'] : null; - $this->container['map_map_of_enum'] = isset($data['map_map_of_enum']) ? $data['map_map_of_enum'] : null; $this->container['map_of_enum_string'] = isset($data['map_of_enum_string']) ? $data['map_of_enum_string'] : null; } @@ -173,10 +157,6 @@ class MapTest implements ArrayAccess { $invalid_properties = array(); $allowed_values = array(); - if (!in_array($this->container['map_map_of_enum'], $allowed_values)) { - $invalid_properties[] = "invalid value for 'map_map_of_enum', must be one of #{allowed_values}."; - } - $allowed_values = array(); if (!in_array($this->container['map_of_enum_string'], $allowed_values)) { $invalid_properties[] = "invalid value for 'map_of_enum_string', must be one of #{allowed_values}."; } @@ -191,10 +171,6 @@ class MapTest implements ArrayAccess */ public function valid() { - $allowed_values = array(); - if (!in_array($this->container['map_map_of_enum'], $allowed_values)) { - return false; - } $allowed_values = array(); if (!in_array($this->container['map_of_enum_string'], $allowed_values)) { return false; @@ -224,31 +200,6 @@ class MapTest implements ArrayAccess return $this; } - /** - * Gets map_map_of_enum - * @return map[string,map[string,string]] - */ - public function getMapMapOfEnum() - { - return $this->container['map_map_of_enum']; - } - - /** - * Sets map_map_of_enum - * @param map[string,map[string,string]] $map_map_of_enum - * @return $this - */ - public function setMapMapOfEnum($map_map_of_enum) - { - $allowed_values = array(); - if (!in_array($map_map_of_enum, $allowed_values)) { - throw new \InvalidArgumentException("Invalid value for 'map_map_of_enum', must be one of "); - } - $this->container['map_map_of_enum'] = $map_map_of_enum; - - return $this; - } - /** * Gets map_of_enum_string * @return map[string,string] diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index fe68a3877d6..ce77aa6c3b3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -264,7 +264,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { + } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') {