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 877e5dabfa7..218b5c1f1da 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 @@ -3929,6 +3929,11 @@ public class DefaultCodegen implements CodegenConfig { List parameters = new ArrayList(); LOGGER.debug("debugging fromRequestBodyToFormParameters= " + body); Schema schema = getSchemaFromBody(body); + if (StringUtils.isNotBlank(schema.get$ref())) { + schema = schemas.get( + getSimpleRef(schema.get$ref()) + ); + } if (schema.getProperties() != null && !schema.getProperties().isEmpty()) { Map properties = schema.getProperties(); for (Map.Entry entry : properties.entrySet()) { 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 f68855dfd30..9f79de03403 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() +> testEndpointParameters($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -284,9 +284,23 @@ $apiInstance = new Swagger\Client\Api\FakeApi( new GuzzleHttp\Client(), $config ); +$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 +$password = "password_example"; // string | None +$callback = "callback_example"; // string | None try { - $apiInstance->testEndpointParameters(); + $apiInstance->testEndpointParameters($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback); } catch (Exception $e) { echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), PHP_EOL; } @@ -294,7 +308,23 @@ try { ``` ### Parameters -This endpoint does not need any parameter. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **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] + **password** | **string**| None | [optional] + **callback** | **string**| None | [optional] ### Return type @@ -312,7 +342,7 @@ void (empty response body) [[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) # **testEnumParameters** -> testEnumParameters($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer) +> testEnumParameters($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double) To test enum parameters @@ -333,9 +363,12 @@ $enum_header_string = "enum_header_string_example"; // string | Header parameter $enum_query_string_array = array("enum_query_string_array_example"); // string[] | Query parameter enum test (string array) $enum_query_string = "enum_query_string_example"; // string | Query parameter enum test (string) $enum_query_integer = 56; // int | Query parameter enum test (double) +$enum_form_string_array = new \Swagger\Client\Model\array(); // string[] | Form parameter enum test (string array) +$enum_form_string = "enum_form_string_example"; // string | Form parameter enum test (string) +$enum_query_double = 3.4; // double | Query parameter enum test (double) try { - $apiInstance->testEnumParameters($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer); + $apiInstance->testEnumParameters($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double); } catch (Exception $e) { echo 'Exception when calling FakeApi->testEnumParameters: ', $e->getMessage(), PHP_EOL; } @@ -351,6 +384,9 @@ Name | Type | Description | Notes **enum_query_string_array** | [**string[]**](../Model/string.md)| Query parameter enum test (string array) | [optional] **enum_query_string** | **string**| Query parameter enum test (string) | [optional] **enum_query_integer** | **int**| Query parameter enum test (double) | [optional] + **enum_form_string_array** | [**string[]**](../Model/array.md)| Form parameter enum test (string array) | [optional] + **enum_form_string** | **string**| Form parameter enum test (string) | [optional] + **enum_query_double** | **double**| Query parameter enum test (double) | [optional] ### Return type @@ -414,7 +450,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) # **testJsonFormData** -> testJsonFormData() +> testJsonFormData($param, $param2) test json serialization of form data @@ -428,9 +464,11 @@ $apiInstance = new Swagger\Client\Api\FakeApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); +$param = "param_example"; // string | field1 +$param2 = "param2_example"; // string | field2 try { - $apiInstance->testJsonFormData(); + $apiInstance->testJsonFormData($param, $param2); } catch (Exception $e) { echo 'Exception when calling FakeApi->testJsonFormData: ', $e->getMessage(), PHP_EOL; } @@ -438,7 +476,11 @@ try { ``` ### Parameters -This endpoint does not need any parameter. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **string**| field1 | [optional] + **param2** | **string**| field2 | [optional] ### Return type diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/PetApi.md b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/PetApi.md index d4fac6cf75b..dc6a9fb94e1 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/PetApi.md +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/PetApi.md @@ -328,7 +328,7 @@ void (empty response body) [[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) # **updatePetWithForm** -> updatePetWithForm($pet_id) +> updatePetWithForm($pet_id, $name, $status) Updates a pet in the store with form data @@ -347,9 +347,11 @@ $apiInstance = new Swagger\Client\Api\PetApi( $config ); $pet_id = 789; // int | ID of pet that needs to be updated +$name = "name_example"; // string | Updated name of the pet +$status = "status_example"; // string | Updated status of the pet try { - $apiInstance->updatePetWithForm($pet_id); + $apiInstance->updatePetWithForm($pet_id, $name, $status); } catch (Exception $e) { echo 'Exception when calling PetApi->updatePetWithForm: ', $e->getMessage(), PHP_EOL; } @@ -361,6 +363,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pet_id** | **int**| ID of pet that needs to be updated | + **name** | **string**| Updated name of the pet | [optional] + **status** | **string**| Updated status of the pet | [optional] ### Return type @@ -378,7 +382,7 @@ void (empty response body) [[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) # **uploadFile** -> \Swagger\Client\Model\ApiResponse uploadFile($pet_id) +> \Swagger\Client\Model\ApiResponse uploadFile($pet_id, $additional_metadata, $file) uploads an image @@ -397,9 +401,11 @@ $apiInstance = new Swagger\Client\Api\PetApi( $config ); $pet_id = 789; // int | ID of pet to update +$additional_metadata = "additional_metadata_example"; // string | Additional data to pass to server +$file = "file_example"; // string | file to upload try { - $result = $apiInstance->uploadFile($pet_id); + $result = $apiInstance->uploadFile($pet_id, $additional_metadata, $file); print_r($result); } catch (Exception $e) { echo 'Exception when calling PetApi->uploadFile: ', $e->getMessage(), PHP_EOL; @@ -412,6 +418,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pet_id** | **int**| ID of pet to update | + **additional_metadata** | **string**| Additional data to pass to server | [optional] + **file** | **string**| file to upload | [optional] ### 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 0db5bde5f4b..0ffa7def36f 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,14 +1337,28 @@ class FakeApi * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * + * @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) + * @param string $password None (optional) + * @param string $callback None (optional) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function testEndpointParameters() + 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) { - $this->testEndpointParametersWithHttpInfo(); + $this->testEndpointParametersWithHttpInfo($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback); } /** @@ -1352,15 +1366,29 @@ class FakeApi * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * + * @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) + * @param string $password None (optional) + * @param string $callback None (optional) * * @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 testEndpointParametersWithHttpInfo() + 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) { $returnType = ''; - $request = $this->testEndpointParametersRequest(); + $request = $this->testEndpointParametersRequest($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback); try { $options = $this->createHttpClientOption(); @@ -1404,13 +1432,27 @@ class FakeApi * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * + * @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) + * @param string $password None (optional) + * @param string $callback None (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testEndpointParametersAsync() + 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) { - return $this->testEndpointParametersAsyncWithHttpInfo() + return $this->testEndpointParametersAsyncWithHttpInfo($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback) ->then( function ($response) { return $response[0]; @@ -1423,14 +1465,28 @@ class FakeApi * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * + * @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) + * @param string $password None (optional) + * @param string $callback None (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testEndpointParametersAsyncWithHttpInfo() + 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) { $returnType = ''; - $request = $this->testEndpointParametersRequest(); + $request = $this->testEndpointParametersRequest($integer, $int32, $int64, $number, $float, $double, $string, $pattern_without_delimiter, $byte, $binary, $date, $date_time, $password, $callback); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1458,12 +1514,65 @@ class FakeApi /** * Create request for operation 'testEndpointParameters' * + * @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) + * @param string $password None (optional) + * @param string $callback None (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function testEndpointParametersRequest() + 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) { + if ($integer !== null && $integer > 100) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.'); + } + if ($integer !== null && $integer < 10) { + throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); + } + + if ($int32 !== null && $int32 > 200) { + throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.'); + } + if ($int32 !== null && $int32 < 20) { + 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.'); + } + if ($password !== null && strlen($password) < 10) { + throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); + } + $resourcePath = '/fake'; $formParams = []; @@ -1474,6 +1583,62 @@ class FakeApi + // form params + if ($integer !== null) { + $formParams['integer'] = ObjectSerializer::toFormValue($integer); + } + // form params + if ($int32 !== null) { + $formParams['int32'] = ObjectSerializer::toFormValue($int32); + } + // form params + if ($int64 !== null) { + $formParams['int64'] = ObjectSerializer::toFormValue($int64); + } + // form params + if ($number !== null) { + $formParams['number'] = ObjectSerializer::toFormValue($number); + } + // form params + if ($float !== null) { + $formParams['float'] = ObjectSerializer::toFormValue($float); + } + // form params + if ($double !== null) { + $formParams['double'] = ObjectSerializer::toFormValue($double); + } + // form params + if ($string !== null) { + $formParams['string'] = ObjectSerializer::toFormValue($string); + } + // form params + if ($pattern_without_delimiter !== null) { + $formParams['pattern_without_delimiter'] = ObjectSerializer::toFormValue($pattern_without_delimiter); + } + // form params + if ($byte !== null) { + $formParams['byte'] = ObjectSerializer::toFormValue($byte); + } + // form params + if ($binary !== null) { + $formParams['binary'] = ObjectSerializer::toFormValue($binary); + } + // form params + if ($date !== null) { + $formParams['date'] = ObjectSerializer::toFormValue($date); + } + // form params + if ($date_time !== null) { + $formParams['dateTime'] = ObjectSerializer::toFormValue($date_time); + } + // form params + if ($password !== null) { + $formParams['password'] = ObjectSerializer::toFormValue($password); + } + // form params + if ($callback !== null) { + $formParams['callback'] = ObjectSerializer::toFormValue($callback); + } // body params $_tempBody = null; @@ -1552,14 +1717,17 @@ class FakeApi * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) * @param string $enum_query_string Query parameter enum test (string) (optional) * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional) + * @param string $enum_form_string Form parameter enum test (string) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function testEnumParameters($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null) + public function testEnumParameters($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null) { - $this->testEnumParametersWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer); + $this->testEnumParametersWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double); } /** @@ -1572,15 +1740,18 @@ class FakeApi * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) * @param string $enum_query_string Query parameter enum test (string) (optional) * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional) + * @param string $enum_form_string Form parameter enum test (string) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) * * @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 testEnumParametersWithHttpInfo($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null) + public function testEnumParametersWithHttpInfo($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null) { $returnType = ''; - $request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer); + $request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double); try { $options = $this->createHttpClientOption(); @@ -1629,13 +1800,16 @@ class FakeApi * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) * @param string $enum_query_string Query parameter enum test (string) (optional) * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional) + * @param string $enum_form_string Form parameter enum test (string) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null) + public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null) { - return $this->testEnumParametersAsyncWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer) + return $this->testEnumParametersAsyncWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double) ->then( function ($response) { return $response[0]; @@ -1653,14 +1827,17 @@ class FakeApi * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) * @param string $enum_query_string Query parameter enum test (string) (optional) * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional) + * @param string $enum_form_string Form parameter enum test (string) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null) + public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null) { $returnType = ''; - $request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer); + $request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1693,11 +1870,14 @@ class FakeApi * @param string[] $enum_query_string_array Query parameter enum test (string array) (optional) * @param string $enum_query_string Query parameter enum test (string) (optional) * @param int $enum_query_integer Query parameter enum test (double) (optional) + * @param string[] $enum_form_string_array Form parameter enum test (string array) (optional) + * @param string $enum_form_string Form parameter enum test (string) (optional) + * @param double $enum_query_double Query parameter enum test (double) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function testEnumParametersRequest($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null) + protected function testEnumParametersRequest($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null) { $resourcePath = '/fake'; @@ -1732,6 +1912,18 @@ class FakeApi } + // form params + if ($enum_form_string_array !== null) { + $formParams['enum_form_string_array'] = ObjectSerializer::toFormValue($enum_form_string_array); + } + // form params + if ($enum_form_string !== null) { + $formParams['enum_form_string'] = ObjectSerializer::toFormValue($enum_form_string); + } + // form params + if ($enum_query_double !== null) { + $formParams['enum_query_double'] = ObjectSerializer::toFormValue($enum_query_double); + } // body params $_tempBody = null; @@ -2021,14 +2213,16 @@ class FakeApi * * test json serialization of form data * + * @param string $param field1 (optional) + * @param string $param2 field2 (optional) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function testJsonFormData() + public function testJsonFormData($param = null, $param2 = null) { - $this->testJsonFormDataWithHttpInfo(); + $this->testJsonFormDataWithHttpInfo($param, $param2); } /** @@ -2036,15 +2230,17 @@ class FakeApi * * test json serialization of form data * + * @param string $param field1 (optional) + * @param string $param2 field2 (optional) * * @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() + public function testJsonFormDataWithHttpInfo($param = null, $param2 = null) { $returnType = ''; - $request = $this->testJsonFormDataRequest(); + $request = $this->testJsonFormDataRequest($param, $param2); try { $options = $this->createHttpClientOption(); @@ -2088,13 +2284,15 @@ class FakeApi * * test json serialization of form data * + * @param string $param field1 (optional) + * @param string $param2 field2 (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testJsonFormDataAsync() + public function testJsonFormDataAsync($param = null, $param2 = null) { - return $this->testJsonFormDataAsyncWithHttpInfo() + return $this->testJsonFormDataAsyncWithHttpInfo($param, $param2) ->then( function ($response) { return $response[0]; @@ -2107,14 +2305,16 @@ class FakeApi * * test json serialization of form data * + * @param string $param field1 (optional) + * @param string $param2 field2 (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testJsonFormDataAsyncWithHttpInfo() + public function testJsonFormDataAsyncWithHttpInfo($param = null, $param2 = null) { $returnType = ''; - $request = $this->testJsonFormDataRequest(); + $request = $this->testJsonFormDataRequest($param, $param2); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2142,11 +2342,13 @@ class FakeApi /** * Create request for operation 'testJsonFormData' * + * @param string $param field1 (optional) + * @param string $param2 field2 (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function testJsonFormDataRequest() + protected function testJsonFormDataRequest($param = null, $param2 = null) { $resourcePath = '/fake/jsonFormData'; @@ -2158,6 +2360,14 @@ class FakeApi + // form params + if ($param !== null) { + $formParams['param'] = ObjectSerializer::toFormValue($param); + } + // form params + if ($param2 !== null) { + $formParams['param2'] = ObjectSerializer::toFormValue($param2); + } // body params $_tempBody = null; diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index bce65b0d6a2..a0fb0b9a48e 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -1576,14 +1576,16 @@ class PetApi * Updates a pet in the store with form data * * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function updatePetWithForm($pet_id) + public function updatePetWithForm($pet_id, $name = null, $status = null) { - $this->updatePetWithFormWithHttpInfo($pet_id); + $this->updatePetWithFormWithHttpInfo($pet_id, $name, $status); } /** @@ -1592,15 +1594,17 @@ class PetApi * Updates a pet in the store with form data * * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * * @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 updatePetWithFormWithHttpInfo($pet_id) + public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = null) { $returnType = ''; - $request = $this->updatePetWithFormRequest($pet_id); + $request = $this->updatePetWithFormRequest($pet_id, $name, $status); try { $options = $this->createHttpClientOption(); @@ -1645,13 +1649,15 @@ class PetApi * Updates a pet in the store with form data * * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePetWithFormAsync($pet_id) + public function updatePetWithFormAsync($pet_id, $name = null, $status = null) { - return $this->updatePetWithFormAsyncWithHttpInfo($pet_id) + return $this->updatePetWithFormAsyncWithHttpInfo($pet_id, $name, $status) ->then( function ($response) { return $response[0]; @@ -1665,14 +1671,16 @@ class PetApi * Updates a pet in the store with form data * * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePetWithFormAsyncWithHttpInfo($pet_id) + public function updatePetWithFormAsyncWithHttpInfo($pet_id, $name = null, $status = null) { $returnType = ''; - $request = $this->updatePetWithFormRequest($pet_id); + $request = $this->updatePetWithFormRequest($pet_id, $name, $status); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1701,11 +1709,13 @@ class PetApi * Create request for operation 'updatePetWithForm' * * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updatePetWithFormRequest($pet_id) + protected function updatePetWithFormRequest($pet_id, $name = null, $status = null) { // verify the required parameter 'pet_id' is set if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { @@ -1731,6 +1741,14 @@ class PetApi ); } + // form params + if ($name !== null) { + $formParams['name'] = ObjectSerializer::toFormValue($name); + } + // form params + if ($status !== null) { + $formParams['status'] = ObjectSerializer::toFormValue($status); + } // body params $_tempBody = null; @@ -1805,14 +1823,16 @@ class PetApi * uploads an image * * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param string $file file to upload (optional) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\ApiResponse */ - public function uploadFile($pet_id) + public function uploadFile($pet_id, $additional_metadata = null, $file = null) { - list($response) = $this->uploadFileWithHttpInfo($pet_id); + list($response) = $this->uploadFileWithHttpInfo($pet_id, $additional_metadata, $file); return $response; } @@ -1822,15 +1842,17 @@ class PetApi * uploads an image * * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param string $file file to upload (optional) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) */ - public function uploadFileWithHttpInfo($pet_id) + public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $file = null) { $returnType = '\Swagger\Client\Model\ApiResponse'; - $request = $this->uploadFileRequest($pet_id); + $request = $this->uploadFileRequest($pet_id, $additional_metadata, $file); try { $options = $this->createHttpClientOption(); @@ -1897,13 +1919,15 @@ class PetApi * uploads an image * * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param string $file file to upload (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function uploadFileAsync($pet_id) + public function uploadFileAsync($pet_id, $additional_metadata = null, $file = null) { - return $this->uploadFileAsyncWithHttpInfo($pet_id) + return $this->uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata, $file) ->then( function ($response) { return $response[0]; @@ -1917,14 +1941,16 @@ class PetApi * uploads an image * * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param string $file file to upload (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function uploadFileAsyncWithHttpInfo($pet_id) + public function uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata = null, $file = null) { $returnType = '\Swagger\Client\Model\ApiResponse'; - $request = $this->uploadFileRequest($pet_id); + $request = $this->uploadFileRequest($pet_id, $additional_metadata, $file); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1967,11 +1993,13 @@ class PetApi * Create request for operation 'uploadFile' * * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param string $file file to upload (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function uploadFileRequest($pet_id) + protected function uploadFileRequest($pet_id, $additional_metadata = null, $file = null) { // verify the required parameter 'pet_id' is set if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { @@ -1997,6 +2025,14 @@ class PetApi ); } + // form params + if ($additional_metadata !== null) { + $formParams['additionalMetadata'] = ObjectSerializer::toFormValue($additional_metadata); + } + // form params + if ($file !== null) { + $formParams['file'] = ObjectSerializer::toFormValue($file); + } // body params $_tempBody = null;