From bd19c6bdea97b255355f6893f2483b899d7f54f7 Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Sun, 1 Apr 2018 12:11:29 +0900 Subject: [PATCH 1/3] Update samples under openapi3 folder Apply changes that comes with master bin/openapi3/php-petstore.sh --- .../php/SwaggerClient-php/lib/Model/Body2.php | 12 +++++----- .../lib/Model/EnumArrays.php | 6 ++--- .../SwaggerClient-php/lib/Model/EnumTest.php | 24 +++++++++---------- .../php/SwaggerClient-php/lib/Model/Order.php | 6 ++--- .../php/SwaggerClient-php/lib/Model/Pet.php | 6 ++--- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Body2.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Body2.php index 87f5415a615..11705bc054d 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Body2.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Body2.php @@ -249,7 +249,7 @@ class Body2 implements ModelInterface, ArrayAccess $invalidProperties = []; $allowedValues = $this->getEnumFormStringAllowableValues(); - if (!is_null($this->container['enum_form_string']) && !in_array($this->container['enum_form_string'], $allowedValues)) { + if (!is_null($this->container['enum_form_string']) && !in_array($this->container['enum_form_string'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'enum_form_string', must be one of '%s'", implode("', '", $allowedValues) @@ -257,7 +257,7 @@ class Body2 implements ModelInterface, ArrayAccess } $allowedValues = $this->getEnumQueryDoubleAllowableValues(); - if (!is_null($this->container['enum_query_double']) && !in_array($this->container['enum_query_double'], $allowedValues)) { + if (!is_null($this->container['enum_query_double']) && !in_array($this->container['enum_query_double'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'enum_query_double', must be one of '%s'", implode("', '", $allowedValues) @@ -277,11 +277,11 @@ class Body2 implements ModelInterface, ArrayAccess { $allowedValues = $this->getEnumFormStringAllowableValues(); - if (!is_null($this->container['enum_form_string']) && !in_array($this->container['enum_form_string'], $allowedValues)) { + if (!is_null($this->container['enum_form_string']) && !in_array($this->container['enum_form_string'], $allowedValues, true)) { return false; } $allowedValues = $this->getEnumQueryDoubleAllowableValues(); - if (!is_null($this->container['enum_query_double']) && !in_array($this->container['enum_query_double'], $allowedValues)) { + if (!is_null($this->container['enum_query_double']) && !in_array($this->container['enum_query_double'], $allowedValues, true)) { return false; } return true; @@ -341,7 +341,7 @@ class Body2 implements ModelInterface, ArrayAccess public function setEnumFormString($enum_form_string) { $allowedValues = $this->getEnumFormStringAllowableValues(); - if (!is_null($enum_form_string) && !in_array($enum_form_string, $allowedValues)) { + if (!is_null($enum_form_string) && !in_array($enum_form_string, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'enum_form_string', must be one of '%s'", @@ -374,7 +374,7 @@ class Body2 implements ModelInterface, ArrayAccess public function setEnumQueryDouble($enum_query_double) { $allowedValues = $this->getEnumQueryDoubleAllowableValues(); - if (!is_null($enum_query_double) && !in_array($enum_query_double, $allowedValues)) { + if (!is_null($enum_query_double) && !in_array($enum_query_double, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'enum_query_double', must be one of '%s'", diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php index 869d285b752..26a6c705d49 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php @@ -226,7 +226,7 @@ class EnumArrays implements ModelInterface, ArrayAccess $invalidProperties = []; $allowedValues = $this->getJustSymbolAllowableValues(); - if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues)) { + if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'just_symbol', must be one of '%s'", implode("', '", $allowedValues) @@ -246,7 +246,7 @@ class EnumArrays implements ModelInterface, ArrayAccess { $allowedValues = $this->getJustSymbolAllowableValues(); - if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues)) { + if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues, true)) { return false; } return true; @@ -273,7 +273,7 @@ class EnumArrays implements ModelInterface, ArrayAccess public function setJustSymbol($just_symbol) { $allowedValues = $this->getJustSymbolAllowableValues(); - if (!is_null($just_symbol) && !in_array($just_symbol, $allowedValues)) { + if (!is_null($just_symbol) && !in_array($just_symbol, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'just_symbol', must be one of '%s'", diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index cb74a40e686..e57642debf2 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -278,7 +278,7 @@ class EnumTest implements ModelInterface, ArrayAccess $invalidProperties = []; $allowedValues = $this->getEnumStringAllowableValues(); - if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues)) { + if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'enum_string', must be one of '%s'", implode("', '", $allowedValues) @@ -289,7 +289,7 @@ class EnumTest implements ModelInterface, ArrayAccess $invalidProperties[] = "'enum_string_required' can't be null"; } $allowedValues = $this->getEnumStringRequiredAllowableValues(); - if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues)) { + if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'enum_string_required', must be one of '%s'", implode("', '", $allowedValues) @@ -297,7 +297,7 @@ class EnumTest implements ModelInterface, ArrayAccess } $allowedValues = $this->getEnumIntegerAllowableValues(); - if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues)) { + if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'enum_integer', must be one of '%s'", implode("', '", $allowedValues) @@ -305,7 +305,7 @@ class EnumTest implements ModelInterface, ArrayAccess } $allowedValues = $this->getEnumNumberAllowableValues(); - if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues)) { + if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'enum_number', must be one of '%s'", implode("', '", $allowedValues) @@ -325,22 +325,22 @@ class EnumTest implements ModelInterface, ArrayAccess { $allowedValues = $this->getEnumStringAllowableValues(); - if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues)) { + if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues, true)) { return false; } if ($this->container['enum_string_required'] === null) { return false; } $allowedValues = $this->getEnumStringRequiredAllowableValues(); - if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues)) { + if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues, true)) { return false; } $allowedValues = $this->getEnumIntegerAllowableValues(); - if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues)) { + if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues, true)) { return false; } $allowedValues = $this->getEnumNumberAllowableValues(); - if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues)) { + if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues, true)) { return false; } return true; @@ -367,7 +367,7 @@ class EnumTest implements ModelInterface, ArrayAccess public function setEnumString($enum_string) { $allowedValues = $this->getEnumStringAllowableValues(); - if (!is_null($enum_string) && !in_array($enum_string, $allowedValues)) { + if (!is_null($enum_string) && !in_array($enum_string, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'enum_string', must be one of '%s'", @@ -400,7 +400,7 @@ class EnumTest implements ModelInterface, ArrayAccess public function setEnumStringRequired($enum_string_required) { $allowedValues = $this->getEnumStringRequiredAllowableValues(); - if (!in_array($enum_string_required, $allowedValues)) { + if (!in_array($enum_string_required, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'enum_string_required', must be one of '%s'", @@ -433,7 +433,7 @@ class EnumTest implements ModelInterface, ArrayAccess public function setEnumInteger($enum_integer) { $allowedValues = $this->getEnumIntegerAllowableValues(); - if (!is_null($enum_integer) && !in_array($enum_integer, $allowedValues)) { + if (!is_null($enum_integer) && !in_array($enum_integer, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'enum_integer', must be one of '%s'", @@ -466,7 +466,7 @@ class EnumTest implements ModelInterface, ArrayAccess public function setEnumNumber($enum_number) { $allowedValues = $this->getEnumNumberAllowableValues(); - if (!is_null($enum_number) && !in_array($enum_number, $allowedValues)) { + if (!is_null($enum_number) && !in_array($enum_number, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'enum_number', must be one of '%s'", diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index 95ea07a494c..a5dfe109abb 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -237,7 +237,7 @@ class Order implements ModelInterface, ArrayAccess $invalidProperties = []; $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues)) { + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", implode("', '", $allowedValues) @@ -257,7 +257,7 @@ class Order implements ModelInterface, ArrayAccess { $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues)) { + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { return false; } return true; @@ -380,7 +380,7 @@ class Order implements ModelInterface, ArrayAccess public function setStatus($status) { $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues)) { + if (!is_null($status) && !in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php index f2b9b15b013..3ad44bb0605 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -243,7 +243,7 @@ class Pet implements ModelInterface, ArrayAccess $invalidProperties[] = "'photo_urls' can't be null"; } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues)) { + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", implode("', '", $allowedValues) @@ -269,7 +269,7 @@ class Pet implements ModelInterface, ArrayAccess return false; } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues)) { + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { return false; } return true; @@ -416,7 +416,7 @@ class Pet implements ModelInterface, ArrayAccess public function setStatus($status) { $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues)) { + if (!is_null($status) && !in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", From 8e191a121b6441365067be2711754e9afcc214c9 Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Sun, 1 Apr 2018 13:05:57 +0900 Subject: [PATCH 2/3] Fix 'required' flag --- .../main/java/org/openapitools/codegen/DefaultCodegen.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 218b5c1f1da..412efb85093 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -3942,6 +3942,11 @@ public class DefaultCodegen implements CodegenConfig { // value => property schema codegenParameter = fromFormProperty(entry.getKey(), entry.getValue(), imports); + // Set 'required' flag defined in the schema element + if (!codegenParameter.required && schema.getRequired() != null) { + codegenParameter.required = schema.getRequired().contains(entry.getKey()); + } + parameters.add(codegenParameter); } } From 57bb63bd77828f56363aca61125a70f371eaf88e Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Sun, 1 Apr 2018 13:07:20 +0900 Subject: [PATCH 3/3] Update the sample codes bin/openapi3/php-petstore.sh --- .../php/SwaggerClient-php/docs/Api/FakeApi.md | 24 +-- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 152 +++++++++++------- 2 files changed, 106 insertions(+), 70 deletions(-) diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md index 9f79de03403..93a0a021bed 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md @@ -261,7 +261,7 @@ No authorization required [[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) # **testEndpointParameters** -> testEndpointParameters($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback) +> testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -284,15 +284,15 @@ $apiInstance = new Swagger\Client\Api\FakeApi( new GuzzleHttp\Client(), $config ); +$number = new \Swagger\Client\Model\BigDecimal(); // BigDecimal | None +$double = 3.4; // double | None +$pattern_without_delimiter = "pattern_without_delimiter_example"; // string | None +$byte = "byte_example"; // string | None $integer = 56; // int | None $int32 = 56; // int | None $int64 = 56; // int | None -$number = new \Swagger\Client\Model\BigDecimal(); // BigDecimal | None $float = 3.4; // float | None -$double = 3.4; // double | None $string = "string_example"; // string | None -$pattern_without_delimiter = "pattern_without_delimiter_example"; // string | None -$byte = "byte_example"; // string | None $binary = "binary_example"; // string | None $date = "date_example"; // \DateTime | None $date_time = "date_time_example"; // \DateTime | None @@ -300,7 +300,7 @@ $password = "password_example"; // string | None $callback = "callback_example"; // string | None try { - $apiInstance->testEndpointParameters($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback); + $apiInstance->testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); } catch (Exception $e) { echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), PHP_EOL; } @@ -311,15 +311,15 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **number** | **BigDecimal**| None | + **double** | **double**| None | + **pattern_without_delimiter** | **string**| None | + **byte** | **string**| None | **integer** | **int**| None | [optional] **int32** | **int**| None | [optional] **int64** | **int**| None | [optional] - **number** | **BigDecimal**| None | [optional] **float** | **float**| None | [optional] - **double** | **double**| None | [optional] **string** | **string**| None | [optional] - **pattern_without_delimiter** | **string**| None | [optional] - **byte** | **string**| None | [optional] **binary** | **string**| None | [optional] **date** | **\DateTime**| None | [optional] **date_time** | **\DateTime**| None | [optional] @@ -479,8 +479,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **string**| field1 | [optional] - **param2** | **string**| field2 | [optional] + **param** | **string**| field1 | + **param2** | **string**| field2 | ### Return type diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 0ffa7def36f..b35eda5bd31 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -1337,15 +1337,15 @@ class FakeApi * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * + * @param BigDecimal $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) * @param int $integer None (optional) * @param int $int32 None (optional) * @param int $int64 None (optional) - * @param BigDecimal $number None (optional) * @param float $float None (optional) - * @param double $double None (optional) * @param string $string None (optional) - * @param string $pattern_without_delimiter None (optional) - * @param string $byte None (optional) * @param string $binary None (optional) * @param \DateTime $date None (optional) * @param \DateTime $date_time None (optional) @@ -1356,9 +1356,9 @@ class FakeApi * @throws \InvalidArgumentException * @return void */ - public function testEndpointParameters($integer = null, $int32 = null, $int64 = null, $number = null, $float = null, $double = null, $string = null, $pattern_without_delimiter = null, $byte = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + public function testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - $this->testEndpointParametersWithHttpInfo($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback); + $this->testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); } /** @@ -1366,15 +1366,15 @@ class FakeApi * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * + * @param BigDecimal $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) * @param int $integer None (optional) * @param int $int32 None (optional) * @param int $int64 None (optional) - * @param BigDecimal $number None (optional) * @param float $float None (optional) - * @param double $double None (optional) * @param string $string None (optional) - * @param string $pattern_without_delimiter None (optional) - * @param string $byte None (optional) * @param string $binary None (optional) * @param \DateTime $date None (optional) * @param \DateTime $date_time None (optional) @@ -1385,10 +1385,10 @@ class FakeApi * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function testEndpointParametersWithHttpInfo($integer = null, $int32 = null, $int64 = null, $number = null, $float = null, $double = null, $string = null, $pattern_without_delimiter = null, $byte = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + public function testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { $returnType = ''; - $request = $this->testEndpointParametersRequest($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback); + $request = $this->testEndpointParametersRequest($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); try { $options = $this->createHttpClientOption(); @@ -1432,15 +1432,15 @@ class FakeApi * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * + * @param BigDecimal $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) * @param int $integer None (optional) * @param int $int32 None (optional) * @param int $int64 None (optional) - * @param BigDecimal $number None (optional) * @param float $float None (optional) - * @param double $double None (optional) * @param string $string None (optional) - * @param string $pattern_without_delimiter None (optional) - * @param string $byte None (optional) * @param string $binary None (optional) * @param \DateTime $date None (optional) * @param \DateTime $date_time None (optional) @@ -1450,9 +1450,9 @@ class FakeApi * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testEndpointParametersAsync($integer = null, $int32 = null, $int64 = null, $number = null, $float = null, $double = null, $string = null, $pattern_without_delimiter = null, $byte = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + public function testEndpointParametersAsync($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - return $this->testEndpointParametersAsyncWithHttpInfo($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback) + return $this->testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) ->then( function ($response) { return $response[0]; @@ -1465,15 +1465,15 @@ class FakeApi * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * + * @param BigDecimal $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) * @param int $integer None (optional) * @param int $int32 None (optional) * @param int $int64 None (optional) - * @param BigDecimal $number None (optional) * @param float $float None (optional) - * @param double $double None (optional) * @param string $string None (optional) - * @param string $pattern_without_delimiter None (optional) - * @param string $byte None (optional) * @param string $binary None (optional) * @param \DateTime $date None (optional) * @param \DateTime $date_time None (optional) @@ -1483,10 +1483,10 @@ class FakeApi * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testEndpointParametersAsyncWithHttpInfo($integer = null, $int32 = null, $int64 = null, $number = null, $float = null, $double = null, $string = null, $pattern_without_delimiter = null, $byte = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + public function testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { $returnType = ''; - $request = $this->testEndpointParametersRequest($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback); + $request = $this->testEndpointParametersRequest($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1514,15 +1514,15 @@ class FakeApi /** * Create request for operation 'testEndpointParameters' * + * @param BigDecimal $number None (required) + * @param double $double None (required) + * @param string $pattern_without_delimiter None (required) + * @param string $byte None (required) * @param int $integer None (optional) * @param int $int32 None (optional) * @param int $int64 None (optional) - * @param BigDecimal $number None (optional) * @param float $float None (optional) - * @param double $double None (optional) * @param string $string None (optional) - * @param string $pattern_without_delimiter None (optional) - * @param string $byte None (optional) * @param string $binary None (optional) * @param \DateTime $date None (optional) * @param \DateTime $date_time None (optional) @@ -1532,8 +1532,46 @@ class FakeApi * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function testEndpointParametersRequest($integer = null, $int32 = null, $int64 = null, $number = null, $float = null, $double = null, $string = null, $pattern_without_delimiter = null, $byte = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) + protected function testEndpointParametersRequest($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { + // verify the required parameter 'number' is set + if ($number === null || (is_array($number) && count($number) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $number when calling testEndpointParameters' + ); + } + 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) { + throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); + } + + // verify the required parameter 'double' is set + if ($double === null || (is_array($double) && count($double) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $double when calling testEndpointParameters' + ); + } + 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) { + throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); + } + + // verify the required parameter 'pattern_without_delimiter' is set + if ($pattern_without_delimiter === null || (is_array($pattern_without_delimiter) && count($pattern_without_delimiter) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pattern_without_delimiter when calling testEndpointParameters' + ); + } + // verify the required parameter 'byte' is set + if ($byte === null || (is_array($byte) && count($byte) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $byte when calling testEndpointParameters' + ); + } if ($integer !== null && $integer > 100) { throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.'); } @@ -1548,24 +1586,10 @@ class FakeApi throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.'); } - if ($number !== null && $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 !== null && $number < 32.1) { - throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.'); - } - if ($float !== null && $float > 987.6) { throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.'); } - if ($double !== null && $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 !== null && $double < 67.8) { - throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.'); - } - if ($password !== null && strlen($password) > 64) { throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); } @@ -2213,14 +2237,14 @@ class FakeApi * * test json serialization of form data * - * @param string $param field1 (optional) - * @param string $param2 field2 (optional) + * @param string $param field1 (required) + * @param string $param2 field2 (required) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function testJsonFormData($param = null, $param2 = null) + public function testJsonFormData($param, $param2) { $this->testJsonFormDataWithHttpInfo($param, $param2); } @@ -2230,14 +2254,14 @@ class FakeApi * * test json serialization of form data * - * @param string $param field1 (optional) - * @param string $param2 field2 (optional) + * @param string $param field1 (required) + * @param string $param2 field2 (required) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function testJsonFormDataWithHttpInfo($param = null, $param2 = null) + public function testJsonFormDataWithHttpInfo($param, $param2) { $returnType = ''; $request = $this->testJsonFormDataRequest($param, $param2); @@ -2284,13 +2308,13 @@ class FakeApi * * test json serialization of form data * - * @param string $param field1 (optional) - * @param string $param2 field2 (optional) + * @param string $param field1 (required) + * @param string $param2 field2 (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testJsonFormDataAsync($param = null, $param2 = null) + public function testJsonFormDataAsync($param, $param2) { return $this->testJsonFormDataAsyncWithHttpInfo($param, $param2) ->then( @@ -2305,13 +2329,13 @@ class FakeApi * * test json serialization of form data * - * @param string $param field1 (optional) - * @param string $param2 field2 (optional) + * @param string $param field1 (required) + * @param string $param2 field2 (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testJsonFormDataAsyncWithHttpInfo($param = null, $param2 = null) + public function testJsonFormDataAsyncWithHttpInfo($param, $param2) { $returnType = ''; $request = $this->testJsonFormDataRequest($param, $param2); @@ -2342,14 +2366,26 @@ class FakeApi /** * Create request for operation 'testJsonFormData' * - * @param string $param field1 (optional) - * @param string $param2 field2 (optional) + * @param string $param field1 (required) + * @param string $param2 field2 (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function testJsonFormDataRequest($param = null, $param2 = null) + protected function testJsonFormDataRequest($param, $param2) { + // verify the required parameter 'param' is set + if ($param === null || (is_array($param) && count($param) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $param when calling testJsonFormData' + ); + } + // verify the required parameter 'param2' is set + if ($param2 === null || (is_array($param2) && count($param2) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $param2 when calling testJsonFormData' + ); + } $resourcePath = '/fake/jsonFormData'; $formParams = [];