Skip to content

Commit f0d3d90

Browse files
committed
[POWERSHELL] fix: keep array context when converting to json
1 parent e914c40 commit f0d3d90

File tree

2 files changed

+3
-3
lines changed
  • modules/openapi-generator/src/main/resources/powershell
  • samples/client/petstore/powershell/src/PSPetstore/Api

2 files changed

+3
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
188188
{{/isNullable}}
189189
{{/required}}
190190
{{#isArray}}
191-
$LocalVarBodyParameter = ,${{{paramName}}} | ConvertTo-Json -Depth 100
191+
$LocalVarBodyParameter = ConvertTo-Json @(${{{paramName}}}) -Depth 100
192192
{{/isArray}}
193193
{{^isArray}}
194194
$LocalVarBodyParameter = ${{{paramName}}} | ConvertTo-Json -Depth 100

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function New-PSUsersWithArrayInput {
133133
throw "Error! The required parameter `User` missing when calling createUsersWithArrayInput."
134134
}
135135

136-
$LocalVarBodyParameter = ,$User | ConvertTo-Json -Depth 100
136+
$LocalVarBodyParameter = ConvertTo-Json @($User) -Depth 100
137137

138138
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
139139
-Uri $LocalVarUri `
@@ -208,7 +208,7 @@ function New-PSUsersWithListInput {
208208
throw "Error! The required parameter `User` missing when calling createUsersWithListInput."
209209
}
210210

211-
$LocalVarBodyParameter = ,$User | ConvertTo-Json -Depth 100
211+
$LocalVarBodyParameter = ConvertTo-Json @($User) -Depth 100
212212

213213
$LocalVarResult = Invoke-PSApiClient -Method 'POST' `
214214
-Uri $LocalVarUri `

0 commit comments

Comments
 (0)