From dfc7714e52f055cd8d58167529d4862f183b59de Mon Sep 17 00:00:00 2001 From: Simon Hammes Date: Fri, 21 Jun 2024 12:50:45 +0200 Subject: [PATCH 1/2] [php] Set $multipart to true if content-type is multipart/form-data (#5536) Related: https://github.com/OpenAPITools/openapi-generator/issues/5536 --- .../src/main/resources/php/api.mustache | 4 + .../lib/Api/AnotherFakeApi.php | 4 + .../OpenAPIClient-php/lib/Api/DefaultApi.php | 4 + .../php/OpenAPIClient-php/lib/Api/FakeApi.php | 88 +++++++++++++++++++ .../lib/Api/FakeClassnameTags123Api.php | 4 + .../php/OpenAPIClient-php/lib/Api/PetApi.php | 36 ++++++++ .../OpenAPIClient-php/lib/Api/StoreApi.php | 16 ++++ .../php/OpenAPIClient-php/lib/Api/UserApi.php | 32 +++++++ 8 files changed, 188 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 30ec1cfc80ab..4423292ea4da 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -687,6 +687,10 @@ use {{invokerPackage}}\ObjectSerializer; } {{/formParams}} + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [{{#produces}}'{{{mediaType}}}', {{/produces}}], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index f671e665594f..ae508a0c67e2 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -368,6 +368,10 @@ public function call123TestSpecialTagsRequest($client, string $contentType = sel + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index beb8ddb3f7d9..9ff55f7662cc 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -348,6 +348,10 @@ public function fooGetRequest(string $contentType = self::contentTypes['fooGet'] + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index c39f19e0fc70..05285ea19992 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -412,6 +412,10 @@ public function fakeBigDecimalMapRequest(string $contentType = self::contentType + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -699,6 +703,10 @@ public function fakeHealthGetRequest(string $contentType = self::contentTypes['f + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -945,6 +953,10 @@ public function fakeHttpSignatureTestRequest($pet, $query_1 = null, $header_1 = + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -1237,6 +1249,10 @@ public function fakeOuterBooleanSerializeRequest($body = null, string $contentTy + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -1529,6 +1545,10 @@ public function fakeOuterCompositeSerializeRequest($outer_composite = null, stri + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -1821,6 +1841,10 @@ public function fakeOuterNumberSerializeRequest($body = null, string $contentTyp + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -2113,6 +2137,10 @@ public function fakeOuterStringSerializeRequest($body = null, string $contentTyp + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -2411,6 +2439,10 @@ public function fakePropertyEnumIntegerSerializeRequest($outer_object_with_enum_ + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -2717,6 +2749,10 @@ public function getParameterNameMappingRequest($underscore_type, $type, $type_wi + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -2938,6 +2974,10 @@ public function testAdditionalPropertiesReferenceRequest($request_body, string $ + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -3158,6 +3198,10 @@ public function testBodyWithBinaryRequest($body, string $contentType = self::con + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -3378,6 +3422,10 @@ public function testBodyWithFileSchemaRequest($file_schema_test_class, string $c + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -3619,6 +3667,10 @@ public function testBodyWithQueryParamsRequest($query, $user, string $contentTyp + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -3925,6 +3977,10 @@ public function testClientModelRequest($client, string $contentType = self::cont + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -4352,6 +4408,10 @@ public function testEndpointParametersRequest($number, $double, $pattern_without $formParams['callback'] = ObjectSerializer::toFormValue($callback); } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -4683,6 +4743,10 @@ public function testEnumParametersRequest($enum_header_string_array = null, $enu $formParams['enum_form_string'] = ObjectSerializer::toFormValue($enum_form_string); } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -5008,6 +5072,10 @@ public function testGroupParametersRequest($associative_array) + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -5233,6 +5301,10 @@ public function testInlineAdditionalPropertiesRequest($request_body, string $con + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -5461,6 +5533,10 @@ public function testInlineFreeformAdditionalPropertiesRequest($test_inline_freef + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -5709,6 +5785,10 @@ public function testJsonFormDataRequest($param, $param2, string $contentType = s $formParams['param2'] = ObjectSerializer::toFormValue($param2); } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -6051,6 +6131,10 @@ public function testQueryParameterCollectionFormatRequest($pipe, $ioutil, $http, + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -6272,6 +6356,10 @@ public function testStringMapReferenceRequest($request_body, string $contentType + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index 9179715876b3..b96b42ba5f5c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -368,6 +368,10 @@ public function testClassnameRequest($client, string $contentType = self::conten + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 4e98ad23551b..1994f6365d8d 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -406,6 +406,10 @@ public function addPetRequest($pet, ?int $hostIndex = null, array $variables = [ + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -708,6 +712,10 @@ public function deletePetRequest($pet_id, $api_key = null, string $contentType = } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -1020,6 +1028,10 @@ public function findPetsByStatusRequest($status, string $contentType = self::con + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1337,6 +1349,10 @@ public function findPetsByTagsRequest($tags, string $contentType = self::content + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1648,6 +1664,10 @@ public function getPetByIdRequest($pet_id, string $contentType = self::contentTy } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1964,6 +1984,10 @@ public function updatePetRequest($pet, ?int $hostIndex = null, array $variables + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -2276,6 +2300,10 @@ public function updatePetWithFormRequest($pet_id, $name = null, $status = null, $formParams['status'] = ObjectSerializer::toFormValue($status); } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -2615,6 +2643,10 @@ public function uploadFileRequest($pet_id, $additional_metadata = null, $file = } } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -2960,6 +2992,10 @@ public function uploadFileWithRequiredFileRequest($pet_id, $required_file, $addi } } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index 96376e959d9c..d8808ab0a946 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -307,6 +307,10 @@ public function deleteOrderRequest($order_id, string $contentType = self::conten } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -594,6 +598,10 @@ public function getInventoryRequest(string $contentType = self::contentTypes['ge + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -912,6 +920,10 @@ public function getOrderByIdRequest($order_id, string $contentType = self::conte } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1211,6 +1223,10 @@ public function placeOrderRequest($order, string $contentType = self::contentTyp + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 845025655d73..8b298e75d8ba 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -311,6 +311,10 @@ public function createUserRequest($user, string $contentType = self::contentType + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -539,6 +543,10 @@ public function createUsersWithArrayInputRequest($user, string $contentType = se + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -767,6 +775,10 @@ public function createUsersWithListInputRequest($user, string $contentType = sel + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -1003,6 +1015,10 @@ public function deleteUserRequest($username, string $contentType = self::content } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -1310,6 +1326,10 @@ public function getUserByNameRequest($username, string $contentType = self::cont } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1639,6 +1659,10 @@ public function loginUserRequest($username, $password, string $contentType = sel + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1848,6 +1872,10 @@ public function logoutUserRequest(string $contentType = self::contentTypes['logo + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -2089,6 +2117,10 @@ public function updateUserRequest($username, $user, string $contentType = self:: } + if ($contentType === 'multipart/form-data') { + $multipart = true; + } + $headers = $this->headerSelector->selectHeaders( [], $contentType, From b5c9cd9f1885bff17a281bf4663d845634c6b4e5 Mon Sep 17 00:00:00 2001 From: simonhammes Date: Thu, 5 Sep 2024 20:16:44 +0200 Subject: [PATCH 2/2] [php] Use isMultipart variable --- .../src/main/resources/php/api.mustache | 7 +- .../lib/Api/AnotherFakeApi.php | 4 - .../OpenAPIClient-php/lib/Api/DefaultApi.php | 4 - .../php/OpenAPIClient-php/lib/Api/FakeApi.php | 88 ------------------- .../lib/Api/FakeClassnameTags123Api.php | 4 - .../php/OpenAPIClient-php/lib/Api/PetApi.php | 38 +------- .../OpenAPIClient-php/lib/Api/StoreApi.php | 16 ---- .../php/OpenAPIClient-php/lib/Api/UserApi.php | 32 ------- 8 files changed, 5 insertions(+), 188 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 4423292ea4da..40f42ea37208 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -687,10 +687,9 @@ use {{invokerPackage}}\ObjectSerializer; } {{/formParams}} - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - + {{#isMultipart}} + $multipart = true; + {{/isMultipart}} $headers = $this->headerSelector->selectHeaders( [{{#produces}}'{{{mediaType}}}', {{/produces}}], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index ae508a0c67e2..f671e665594f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -368,10 +368,6 @@ public function call123TestSpecialTagsRequest($client, string $contentType = sel - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index 9ff55f7662cc..beb8ddb3f7d9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -348,10 +348,6 @@ public function fooGetRequest(string $contentType = self::contentTypes['fooGet'] - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 05285ea19992..c39f19e0fc70 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -412,10 +412,6 @@ public function fakeBigDecimalMapRequest(string $contentType = self::contentType - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -703,10 +699,6 @@ public function fakeHealthGetRequest(string $contentType = self::contentTypes['f - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -953,10 +945,6 @@ public function fakeHttpSignatureTestRequest($pet, $query_1 = null, $header_1 = - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -1249,10 +1237,6 @@ public function fakeOuterBooleanSerializeRequest($body = null, string $contentTy - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -1545,10 +1529,6 @@ public function fakeOuterCompositeSerializeRequest($outer_composite = null, stri - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -1841,10 +1821,6 @@ public function fakeOuterNumberSerializeRequest($body = null, string $contentTyp - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -2137,10 +2113,6 @@ public function fakeOuterStringSerializeRequest($body = null, string $contentTyp - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -2439,10 +2411,6 @@ public function fakePropertyEnumIntegerSerializeRequest($outer_object_with_enum_ - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, @@ -2749,10 +2717,6 @@ public function getParameterNameMappingRequest($underscore_type, $type, $type_wi - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -2974,10 +2938,6 @@ public function testAdditionalPropertiesReferenceRequest($request_body, string $ - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -3198,10 +3158,6 @@ public function testBodyWithBinaryRequest($body, string $contentType = self::con - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -3422,10 +3378,6 @@ public function testBodyWithFileSchemaRequest($file_schema_test_class, string $c - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -3667,10 +3619,6 @@ public function testBodyWithQueryParamsRequest($query, $user, string $contentTyp - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -3977,10 +3925,6 @@ public function testClientModelRequest($client, string $contentType = self::cont - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -4408,10 +4352,6 @@ public function testEndpointParametersRequest($number, $double, $pattern_without $formParams['callback'] = ObjectSerializer::toFormValue($callback); } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -4743,10 +4683,6 @@ public function testEnumParametersRequest($enum_header_string_array = null, $enu $formParams['enum_form_string'] = ObjectSerializer::toFormValue($enum_form_string); } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -5072,10 +5008,6 @@ public function testGroupParametersRequest($associative_array) - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -5301,10 +5233,6 @@ public function testInlineAdditionalPropertiesRequest($request_body, string $con - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -5533,10 +5461,6 @@ public function testInlineFreeformAdditionalPropertiesRequest($test_inline_freef - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -5785,10 +5709,6 @@ public function testJsonFormDataRequest($param, $param2, string $contentType = s $formParams['param2'] = ObjectSerializer::toFormValue($param2); } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -6131,10 +6051,6 @@ public function testQueryParameterCollectionFormatRequest($pipe, $ioutil, $http, - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -6356,10 +6272,6 @@ public function testStringMapReferenceRequest($request_body, string $contentType - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index b96b42ba5f5c..9179715876b3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -368,10 +368,6 @@ public function testClassnameRequest($client, string $contentType = self::conten - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 1994f6365d8d..ceb6d4522064 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -406,10 +406,6 @@ public function addPetRequest($pet, ?int $hostIndex = null, array $variables = [ - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -712,10 +708,6 @@ public function deletePetRequest($pet_id, $api_key = null, string $contentType = } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -1028,10 +1020,6 @@ public function findPetsByStatusRequest($status, string $contentType = self::con - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1349,10 +1337,6 @@ public function findPetsByTagsRequest($tags, string $contentType = self::content - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1664,10 +1648,6 @@ public function getPetByIdRequest($pet_id, string $contentType = self::contentTy } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1984,10 +1964,6 @@ public function updatePetRequest($pet, ?int $hostIndex = null, array $variables - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -2300,10 +2276,6 @@ public function updatePetWithFormRequest($pet_id, $name = null, $status = null, $formParams['status'] = ObjectSerializer::toFormValue($status); } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -2643,10 +2615,7 @@ public function uploadFileRequest($pet_id, $additional_metadata = null, $file = } } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -2992,10 +2961,7 @@ public function uploadFileWithRequiredFileRequest($pet_id, $required_file, $addi } } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index d8808ab0a946..96376e959d9c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -307,10 +307,6 @@ public function deleteOrderRequest($order_id, string $contentType = self::conten } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -598,10 +594,6 @@ public function getInventoryRequest(string $contentType = self::contentTypes['ge - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -920,10 +912,6 @@ public function getOrderByIdRequest($order_id, string $contentType = self::conte } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1223,10 +1211,6 @@ public function placeOrderRequest($order, string $contentType = self::contentTyp - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 8b298e75d8ba..845025655d73 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -311,10 +311,6 @@ public function createUserRequest($user, string $contentType = self::contentType - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -543,10 +539,6 @@ public function createUsersWithArrayInputRequest($user, string $contentType = se - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -775,10 +767,6 @@ public function createUsersWithListInputRequest($user, string $contentType = sel - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -1015,10 +1003,6 @@ public function deleteUserRequest($username, string $contentType = self::content } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -1326,10 +1310,6 @@ public function getUserByNameRequest($username, string $contentType = self::cont } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1659,10 +1639,6 @@ public function loginUserRequest($username, $password, string $contentType = sel - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( ['application/xml', 'application/json', ], $contentType, @@ -1872,10 +1848,6 @@ public function logoutUserRequest(string $contentType = self::contentTypes['logo - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType, @@ -2117,10 +2089,6 @@ public function updateUserRequest($username, $user, string $contentType = self:: } - if ($contentType === 'multipart/form-data') { - $multipart = true; - } - $headers = $this->headerSelector->selectHeaders( [], $contentType,