Skip to content

Commit fe381e2

Browse files
authored
Support multiple files (#19449)
1 parent f13a11b commit fe381e2

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

modules/openapi-generator/src/main/resources/powershell/api.mustache

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
147147
throw "Error! The required parameter `{{paramName}}` missing when calling {{operationId}}."
148148
}
149149
{{#isFile}}
150-
$LocalVarFormParameters['{{baseName}}'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(${{{paramName}}})
150+
$LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
151151
{{/isFile}}
152152
{{^isFile}}
153153
$LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}}
@@ -159,7 +159,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
159159
{{^isNullable}}
160160
if (${{{paramName}}}) {
161161
{{#isFile}}
162-
$LocalVarFormParameters['{{baseName}}'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(${{{paramName}}})
162+
$LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
163163
{{/isFile}}
164164
{{^isFile}}
165165
$LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}}
@@ -169,7 +169,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
169169
{{/isNullable}}
170170
{{#isNullable}}
171171
{{#isFile}}
172-
$LocalVarFormParameters['{{baseName}}'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(${{{paramName}}})
172+
$LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}} | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
173173
{{/isFile}}
174174
{{^isFile}}
175175
$LocalVarFormParameters['{{baseName}}'] = ${{{paramName}}}

samples/client/echo_api/powershell/src/PSOpenAPITools/Api/BodyApi.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function Test-BodyMultipartFormdataArrayOfBinary {
198198
if (!$Files) {
199199
throw "Error! The required parameter `Files` missing when calling test_body_multipart_formdata_arrayOfBinary."
200200
}
201-
$LocalVarFormParameters['files'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Files)
201+
$LocalVarFormParameters['files'] = $Files | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
202202

203203
$LocalVarResult = Invoke-ApiClient -Method 'POST' `
204204
-Uri $LocalVarUri `
@@ -273,7 +273,7 @@ function Test-BodyMultipartFormdataSingleBinary {
273273
$LocalVarUri = '/body/application/octetstream/single_binary'
274274

275275
if ($MyFile) {
276-
$LocalVarFormParameters['my-file'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($MyFile)
276+
$LocalVarFormParameters['my-file'] = $MyFile | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
277277
}
278278

279279
$LocalVarResult = Invoke-ApiClient -Method 'POST' `

samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ function Test-PSEndpointParameters {
909909
$LocalVarFormParameters['byte'] = $Byte
910910

911911
if ($Binary) {
912-
$LocalVarFormParameters['binary'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Binary)
912+
$LocalVarFormParameters['binary'] = $Binary | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
913913
}
914914

915915
if ($Date) {

samples/client/petstore/powershell/src/PSPetstore/Api/PSPetApi.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ function Invoke-PSUploadFile {
679679
}
680680

681681
if ($File) {
682-
$LocalVarFormParameters['file'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($File)
682+
$LocalVarFormParameters['file'] = $File | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
683683
}
684684

685685

@@ -778,7 +778,7 @@ function Invoke-PSUploadFileWithRequiredFile {
778778
if (!$RequiredFile) {
779779
throw "Error! The required parameter `RequiredFile` missing when calling uploadFileWithRequiredFile."
780780
}
781-
$LocalVarFormParameters['requiredFile'] = $executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RequiredFile)
781+
$LocalVarFormParameters['requiredFile'] = $RequiredFile | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
782782

783783

784784
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `

0 commit comments

Comments
 (0)