diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index dfc079874e9..fb03a721e17 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -129,27 +129,27 @@ use \{{invokerPackage}}\ObjectSerializer; {{/required}} {{#hasValidation}} {{#maxLength}} - if (strlen(${{paramName}}) > {{maxLength}}) { + if ({{^required}}!is_null(${{paramName}}) && {{/required}}(strlen(${{paramName}}) > {{maxLength}})) { throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); } {{/maxLength}} {{#minLength}} - if (strlen(${{paramName}}) < {{minLength}}) { + if ({{^required}}!is_null(${{paramName}}) && {{/required}}(strlen(${{paramName}}) < {{minLength}})) { throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); } {{/minLength}} {{#maximum}} - if (${{paramName}} > {{maximum}}) { + if ({{^required}}!is_null(${{paramName}}) && {{/required}}(${{paramName}} > {{maximum}})) { throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); } {{/maximum}} {{#minimum}} - if (${{paramName}} < {{minimum}}) { + if ({{^required}}!is_null(${{paramName}}) && {{/required}}(${{paramName}} < {{minimum}})) { throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); } {{/minimum}} {{#pattern}} - if (!preg_match("{{pattern}}", ${{paramName}})) { + if ({{^required}}!is_null(${{paramName}}) && {{/required}}!preg_match("{{pattern}}", ${{paramName}})) { throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); } {{/pattern}} diff --git a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache index 6e4a3e03f99..3c04809b492 100644 --- a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache @@ -128,27 +128,27 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{/isEnum}} {{#hasValidation}} {{#maxLength}} - if (strlen($this->container['{{name}}']) > {{maxLength}}) { + if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}(strlen($this->container['{{name}}']) > {{maxLength}})) { $invalid_properties[] = "invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; } {{/maxLength}} {{#minLength}} - if (strlen($this->container['{{name}}']) < {{minLength}}) { + if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}(strlen($this->container['{{name}}']) < {{minLength}})) { $invalid_properties[] = "invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}."; } {{/minLength}} {{#maximum}} - if ($this->container['{{name}}'] > {{maximum}}) { + if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}($this->container['{{name}}'] > {{maximum}})) { $invalid_properties[] = "invalid value for '{{name}}', must be smaller than or equal to {{maximum}}."; } {{/maximum}} {{#minimum}} - if ($this->container['{{name}}'] < {{minimum}}) { + if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}($this->container['{{name}}'] < {{minimum}})) { $invalid_properties[] = "invalid value for '{{name}}', must be bigger than or equal to {{minimum}}."; } {{/minimum}} {{#pattern}} - if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { + if ({{^required}}!is_null(${{$this->container['{{name}}']}}) && {{/required}}!preg_match("{{pattern}}", $this->container['{{name}}'])) { $invalid_properties[] = "invalid value for '{{name}}', must be conform to the pattern {{pattern}}."; } {{/pattern}} 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 ea36f234aa7..1b4d4de9e07 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/README.md +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/README.md @@ -1,10 +1,10 @@ # SwaggerClient-php -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r -- Build date: 2016-07-12T18:29:31.200+08:00 +- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r +- Build date: 2016-07-29T14:59:34.783+02:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -58,10 +58,10 @@ Please follow the [installation procedure](#installation--usage) and then run th require_once(__DIR__ . '/vendor/autoload.php'); $api_instance = new Swagger\Client\Api\FakeApi(); -$test_code_inject____end_rn_n_r = "test_code_inject____end_rn_n_r_example"; // string | To test code injection *_/ ' \" =end \\r\\n \\n \\r +$test_code_inject____end____rn_n_r = "test_code_inject____end____rn_n_r_example"; // string | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r try { - $api_instance->testCodeInjectEndRnNR($test_code_inject____end_rn_n_r); + $api_instance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r); } catch (Exception $e) { echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL; } @@ -71,11 +71,11 @@ try { ## Documentation for API Endpoints -All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end \\r\\n \\n \\r/v2 *_/ ' \" =end \\r\\n \\n \\r* +All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*FakeApi* | [**testCodeInjectEndRnNR**](docs/Api/FakeApi.md#testcodeinjectendrnnr) | **PUT** /fake | To test code injection *_/ ' \" =end \\r\\n \\n \\r +*FakeApi* | [**testCodeInjectEndRnNR**](docs/Api/FakeApi.md#testcodeinjectendrnnr) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r ## Documentation For Models @@ -86,24 +86,24 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key */ ' " =end \r\n \n \r -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - - **write:pets**: modify pets in your account */ ' " =end \r\n \n \r - - **read:pets**: read your pets */ ' " =end \r\n \n \r + - **write:pets**: modify pets in your account */ ' " =end -- \r\n \n \r + - **read:pets**: read your pets */ ' " =end -- \r\n \n \r + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r +- **Location**: HTTP header ## Author -apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r +apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/autoload.php b/samples/client/petstore-security-test/php/SwaggerClient-php/autoload.php index 5d845a7a2ad..f4d106bc37b 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/autoload.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/autoload.php @@ -1,12 +1,12 @@ testCodeInjectEndRnNR($test_code_inject____end_rn_n_r) +> testCodeInjectEndRnNR($test_code_inject____end____rn_n_r) -To test code injection *_/ ' \" =end \\r\\n \\n \\r +To test code injection *_/ ' \" =end -- \\r\\n \\n \\r ### Example ```php @@ -18,10 +18,10 @@ To test code injection *_/ ' \" =end \\r\\n \\n \\r require_once(__DIR__ . '/vendor/autoload.php'); $api_instance = new Swagger\Client\Api\FakeApi(); -$test_code_inject____end_rn_n_r = "test_code_inject____end_rn_n_r_example"; // string | To test code injection *_/ ' \" =end \\r\\n \\n \\r +$test_code_inject____end____rn_n_r = "test_code_inject____end____rn_n_r_example"; // string | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r try { - $api_instance->testCodeInjectEndRnNR($test_code_inject____end_rn_n_r); + $api_instance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r); } catch (Exception $e) { echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL; } @@ -32,7 +32,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **test_code_inject____end_rn_n_r** | **string**| To test code injection *_/ ' \" =end \\r\\n \\n \\r | [optional] + **test_code_inject____end____rn_n_r** | **string**| To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | [optional] ### Return type @@ -44,8 +44,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json, *_/ \" =end - - **Accept**: application/json, *_/ \" =end + - **Content-Type**: application/json, *_/ \" =end -- + - **Accept**: application/json, *_/ \" =end -- [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/docs/Model/ModelReturn.md b/samples/client/petstore-security-test/php/SwaggerClient-php/docs/Model/ModelReturn.md index 0e3e582e4bf..efd25fe6d22 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/docs/Model/ModelReturn.md +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/docs/Model/ModelReturn.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**return** | **int** | property description *_/ ' \" =end \\r\\n \\n \\r | [optional] +**return** | **int** | property description *_/ ' \" =end -- \\r\\n \\n \\r | [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-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php index 33942e022ea..4d22ab3e5bd 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 @@ -11,12 +11,12 @@ */ /** - * Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r + * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- * - * OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r - * Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -73,7 +73,7 @@ public function __construct(\Swagger\Client\ApiClient $apiClient = null) { if ($apiClient == null) { $apiClient = new ApiClient(); - $apiClient->getConfig()->setHost('https://petstore.swagger.io *_/ ' \" =end \\r\\n \\n \\r/v2 *_/ ' \" =end \\r\\n \\n \\r'); + $apiClient->getConfig()->setHost('https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'); } $this->apiClient = $apiClient; @@ -105,28 +105,28 @@ public function setApiClient(\Swagger\Client\ApiClient $apiClient) /** * Operation testCodeInjectEndRnNR * - * To test code injection *_/ ' \" =end \\r\\n \\n \\r + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * - * @param string $test_code_inject____end_rn_n_r To test code injection *_/ ' \" =end \\r\\n \\n \\r (optional) + * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function testCodeInjectEndRnNR($test_code_inject____end_rn_n_r = null) + public function testCodeInjectEndRnNR($test_code_inject____end____rn_n_r = null) { - list($response) = $this->testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end_rn_n_r); + list($response) = $this->testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn_n_r); return $response; } /** * Operation testCodeInjectEndRnNRWithHttpInfo * - * To test code injection *_/ ' \" =end \\r\\n \\n \\r + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * - * @param string $test_code_inject____end_rn_n_r To test code injection *_/ ' \" =end \\r\\n \\n \\r (optional) + * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end_rn_n_r = null) + public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn_n_r = null) { // parse inputs $resourcePath = "/fake"; @@ -134,18 +134,18 @@ public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end_rn_n_ $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', '*_/ \" =end')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', '*_/ \" =end --')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','*_/ \" =end')); + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','*_/ \" =end --')); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); // form params - if ($test_code_inject____end_rn_n_r !== null) { - $formParams['test code inject */ ' " =end \r\n \n \r'] = $this->apiClient->getSerializer()->toFormValue($test_code_inject____end_rn_n_r); + if ($test_code_inject____end____rn_n_r !== null) { + $formParams['test code inject */ ' " =end -- \r\n \n \r'] = $this->apiClient->getSerializer()->toFormValue($test_code_inject____end____rn_n_r); } // for model (json/xml) 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 46654c2d6f1..d009534a757 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 @@ -12,12 +12,12 @@ */ /** - * Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r + * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- * - * OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r - * Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiException.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiException.php index c0647bf2d7b..a88687b0b8f 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiException.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiException.php @@ -11,12 +11,12 @@ */ /** - * Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r + * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- * - * OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r - * Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git * * Licensed under the Apache License, Version 2.0 (the "License"); 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 e50e5f6fc23..4f7815f162c 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 @@ -11,12 +11,12 @@ */ /** - * Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r + * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- * - * OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r - * Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -102,7 +102,7 @@ class Configuration * * @var string */ - protected $host = 'https://petstore.swagger.io *_/ ' \" =end \\r\\n \\n \\r/v2 *_/ ' \" =end \\r\\n \\n \\r'; + protected $host = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'; /** * Timeout (second) of the HTTP request, by default set to 0, no timeout @@ -522,7 +522,7 @@ public static function toDebugReport() $report = 'PHP SDK (Swagger\Client) Debug Report:' . PHP_EOL; $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . phpversion() . PHP_EOL; - $report .= ' OpenAPI Spec Version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r' . PHP_EOL; + $report .= ' OpenAPI Spec Version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Model/ModelReturn.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Model/ModelReturn.php index 096464fdeba..1676ca46f8a 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -12,12 +12,12 @@ */ /** - * Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r + * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- * - * OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r - * Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,7 +47,7 @@ * ModelReturn Class Doc Comment * * @category Class */ - // @description Model for testing reserved words *_/ ' \" =end \\r\\n \\n \\r + // @description Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r /** * @package Swagger\Client * @author http://github.com/swagger-api/swagger-codegen @@ -167,7 +167,7 @@ public function getReturn() /** * Sets return - * @param int $return property description *_/ ' \" =end \\r\\n \\n \\r + * @param int $return property description *_/ ' \" =end -- \\r\\n \\n \\r * @return $this */ public function setReturn($return) 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 da912830378..03502e3dae3 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 @@ -12,12 +12,12 @@ */ /** - * Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r + * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- * - * OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r - * Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://github.com/swagger-api/swagger-codegen.git * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -264,7 +264,7 @@ public static function deserialize($data, $class, $httpHeaders = null, $discrimi } 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 52723cf2abb..f5b4c31f8b8 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-07-26T14:38:19.243+08:00 +- Build date: 2016-07-29T14:59:28.041+02:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -136,12 +136,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 @@ -151,6 +145,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/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 0029ff14950..0029ecd0aed 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -236,10 +236,10 @@ public function testEndpointParametersWithHttpInfo($number, $double, $string, $b if ($number === null) { throw new \InvalidArgumentException('Missing the required parameter $number when calling testEndpointParameters'); } - if ($number > 543.2) { + if (($number > 543.2)) { throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.'); } - if ($number < 32.1) { + if (($number < 32.1)) { throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); } @@ -247,10 +247,10 @@ public function testEndpointParametersWithHttpInfo($number, $double, $string, $b if ($double === null) { throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters'); } - if ($double > 123.4) { + if (($double > 123.4)) { throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.'); } - if ($double < 67.8) { + if (($double < 67.8)) { throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); } @@ -266,28 +266,28 @@ public function testEndpointParametersWithHttpInfo($number, $double, $string, $b if ($byte === null) { throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters'); } - if ($integer > 100.0) { + if (!is_null($integer) && ($integer > 100.0)) { throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.'); } - if ($integer < 10.0) { + if (!is_null($integer) && ($integer < 10.0)) { throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.'); } - if ($int32 > 200.0) { + if (!is_null($int32) && ($int32 > 200.0)) { throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.'); } - if ($int32 < 20.0) { + if (!is_null($int32) && ($int32 < 20.0)) { throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.'); } - if ($float > 987.6) { + if (!is_null($float) && ($float > 987.6)) { throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); } - if (strlen($password) > 64) { + if (!is_null($password) && (strlen($password) > 64)) { throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); } - if (strlen($password) < 10) { + if (!is_null($password) && (strlen($password) < 10)) { throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); } 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 6f8bf19eb24..679d67b94ed 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -132,7 +132,7 @@ public function deleteOrderWithHttpInfo($order_id) if ($order_id === null) { throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deleteOrder'); } - if ($order_id < 1.0) { + if (($order_id < 1.0)) { throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.deleteOrder, must be bigger than or equal to 1.0.'); } @@ -293,10 +293,10 @@ public function getOrderByIdWithHttpInfo($order_id) if ($order_id === null) { throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderById'); } - if ($order_id > 5.0) { + if (($order_id > 5.0)) { throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be smaller than or equal to 5.0.'); } - if ($order_id < 1.0) { + if (($order_id < 1.0)) { throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.0.'); } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index b2bbb6806a1..854a8fdc654 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -200,40 +200,40 @@ public function __construct(array $data = null) public function listInvalidProperties() { $invalid_properties = array(); - if ($this->container['integer'] > 100.0) { + if (!is_null(${{$this->container['integer']}}) && ($this->container['integer'] > 100.0)) { $invalid_properties[] = "invalid value for 'integer', must be smaller than or equal to 100.0."; } - if ($this->container['integer'] < 10.0) { + if (!is_null(${{$this->container['integer']}}) && ($this->container['integer'] < 10.0)) { $invalid_properties[] = "invalid value for 'integer', must be bigger than or equal to 10.0."; } - if ($this->container['int32'] > 200.0) { + if (!is_null(${{$this->container['int32']}}) && ($this->container['int32'] > 200.0)) { $invalid_properties[] = "invalid value for 'int32', must be smaller than or equal to 200.0."; } - if ($this->container['int32'] < 20.0) { + if (!is_null(${{$this->container['int32']}}) && ($this->container['int32'] < 20.0)) { $invalid_properties[] = "invalid value for 'int32', must be bigger than or equal to 20.0."; } if ($this->container['number'] === null) { $invalid_properties[] = "'number' can't be null"; } - if ($this->container['number'] > 543.2) { + if (($this->container['number'] > 543.2)) { $invalid_properties[] = "invalid value for 'number', must be smaller than or equal to 543.2."; } - if ($this->container['number'] < 32.1) { + if (($this->container['number'] < 32.1)) { $invalid_properties[] = "invalid value for 'number', must be bigger than or equal to 32.1."; } - if ($this->container['float'] > 987.6) { + if (!is_null(${{$this->container['float']}}) && ($this->container['float'] > 987.6)) { $invalid_properties[] = "invalid value for 'float', must be smaller than or equal to 987.6."; } - if ($this->container['float'] < 54.3) { + if (!is_null(${{$this->container['float']}}) && ($this->container['float'] < 54.3)) { $invalid_properties[] = "invalid value for 'float', must be bigger than or equal to 54.3."; } - if ($this->container['double'] > 123.4) { + if (!is_null(${{$this->container['double']}}) && ($this->container['double'] > 123.4)) { $invalid_properties[] = "invalid value for 'double', must be smaller than or equal to 123.4."; } - if ($this->container['double'] < 67.8) { + if (!is_null(${{$this->container['double']}}) && ($this->container['double'] < 67.8)) { $invalid_properties[] = "invalid value for 'double', must be bigger than or equal to 67.8."; } - if (!preg_match("/[a-z]/i", $this->container['string'])) { + if (!is_null(${{$this->container['string']}}) && !preg_match("/[a-z]/i", $this->container['string'])) { $invalid_properties[] = "invalid value for 'string', must be conform to the pattern /[a-z]/i."; } if ($this->container['byte'] === null) { @@ -245,10 +245,10 @@ public function listInvalidProperties() if ($this->container['password'] === null) { $invalid_properties[] = "'password' can't be null"; } - if (strlen($this->container['password']) > 64) { + if ((strlen($this->container['password']) > 64)) { $invalid_properties[] = "invalid value for 'password', the character length must be smaller than or equal to 64."; } - if (strlen($this->container['password']) < 10) { + if ((strlen($this->container['password']) < 10)) { $invalid_properties[] = "invalid value for 'password', the character length must be bigger than or equal to 10."; } return $invalid_properties; 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 @@ public static function deserialize($data, $class, $httpHeaders = null, $discrimi } 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') {