Skip to content

Commit e279ce4

Browse files
authored
Fix the issue that empty array will be convert to null in PowerShell (#1398)
1 parent ff118d1 commit e279ce4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

powershell/resources/assets/generate-portal-ux.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,16 @@ function New-MetadataForParameterSet()
236236
$cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name
237237
$description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description
238238
[object[]]$example = New-ExampleForParameterSet $ParameterSetInfo
239+
if ($Null -eq $example)
240+
{
241+
$example = @()
242+
}
243+
239244
[string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo
245+
if ($Null -eq $signature)
246+
{
247+
$signature = @()
248+
}
240249

241250
return @{
242251
Path = $httpPath

0 commit comments

Comments
 (0)