diff --git a/modules/openapi-generator/src/main/resources/powershell/api_client.mustache b/modules/openapi-generator/src/main/resources/powershell/api_client.mustache index b17371ad1e3..7d45f071b1e 100644 --- a/modules/openapi-generator/src/main/resources/powershell/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/api_client.mustache @@ -211,6 +211,10 @@ function DeserializeResponse { [string[]]$ContentTypes ) + If ($ContentTypes -eq $null) { + $ContentTypes = [string[]]@() + } + If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response return $Response } Elseif ($ReturnType -match '\[\]$') { # array diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 index 9223b3a93e6..09a202cee9d 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 @@ -198,6 +198,10 @@ function DeserializeResponse { [string[]]$ContentTypes ) + If ($ContentTypes -eq $null) { + $ContentTypes = [string[]]@() + } + If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response return $Response } Elseif ($ReturnType -match '\[\]$') { # array