diff --git a/modules/openapi-generator/src/main/resources/powershell/api.mustache b/modules/openapi-generator/src/main/resources/powershell/api.mustache index 4e8e046775f6..78444914f3df 100644 --- a/modules/openapi-generator/src/main/resources/powershell/api.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/api.mustache @@ -147,7 +147,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} { throw "Error! The required parameter `{{paramName}}` missing when calling {{operationId}}." } {{#isFile}} - $LocalVarFormParameters['{{baseName}}'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(${{{paramName}}}) + $LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) } {{/isFile}} {{^isFile}} $LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} @@ -159,7 +159,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} { {{^isNullable}} if (${{{paramName}}}) { {{#isFile}} - $LocalVarFormParameters['{{baseName}}'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(${{{paramName}}}) + $LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) } {{/isFile}} {{^isFile}} $LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} @@ -169,7 +169,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} { {{/isNullable}} {{#isNullable}} {{#isFile}} - $LocalVarFormParameters['{{baseName}}'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(${{{paramName}}}) + $LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) } {{/isFile}} {{^isFile}} $LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/BodyApi.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/BodyApi.ps1 index df2424106cba..0b7965887527 100644 --- a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/BodyApi.ps1 +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/BodyApi.ps1 @@ -198,7 +198,7 @@ function Test-BodyMultipartFormdataArrayOfBinary { if (!$Files) { throw "Error! The required parameter `Files` missing when calling test_body_multipart_formdata_arrayOfBinary." } - $LocalVarFormParameters['files'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Files) + $LocalVarFormParameters['files'] = $Files | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) } $LocalVarResult = Invoke-ApiClient -Method 'POST' ` -Uri $LocalVarUri ` @@ -273,7 +273,7 @@ function Test-BodyMultipartFormdataSingleBinary { $LocalVarUri = '/body/application/octetstream/single_binary' if ($MyFile) { - $LocalVarFormParameters['my-file'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($MyFile) + $LocalVarFormParameters['my-file'] = $MyFile | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) } } $LocalVarResult = Invoke-ApiClient -Method 'POST' ` diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 index 5e0f3d236044..52d0e4fc5b12 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 @@ -909,7 +909,7 @@ function Test-PSEndpointParameters { $LocalVarFormParameters['byte'] = $Byte if ($Binary) { - $LocalVarFormParameters['binary'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Binary) + $LocalVarFormParameters['binary'] = $Binary | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) } } if ($Date) { diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 index ccbc594a4c6f..c74b4984e998 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1 @@ -679,7 +679,7 @@ function Invoke-PSUploadFile { } if ($File) { - $LocalVarFormParameters['file'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($File) + $LocalVarFormParameters['file'] = $File | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) } } @@ -778,7 +778,7 @@ function Invoke-PSUploadFileWithRequiredFile { if (!$RequiredFile) { throw "Error! The required parameter `RequiredFile` missing when calling uploadFileWithRequiredFile." } - $LocalVarFormParameters['requiredFile'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RequiredFile) + $LocalVarFormParameters['requiredFile'] = $RequiredFile | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) } $LocalVarResult = Invoke-PSApiClient -Method 'POST' `