Skip to content

Commit 27e6db8

Browse files
Update-DocsMsToc.ps1 - Use powershell-yaml 0.4.12, include fixes for breaking behavior change. (#48892)
Co-authored-by: Daniel Jurek <djurek@microsoft.com>
1 parent cb24a79 commit 27e6db8

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

eng/common/scripts/Update-DocsMsToc.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ param(
5555
. $PSScriptRoot/common.ps1
5656
. $PSScriptRoot/Helpers/PSModule-Helpers.ps1
5757

58-
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.7" | Import-Module
58+
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.12" | Import-Module
59+
60+
$loadedModule = Get-Module powershell-yaml
61+
Write-Host "powershell-yaml version loaded: $($loadedModule.Version) from $($loadedModule.ModuleBase)"
5962

6063
Set-StrictMode -Version 3
6164

@@ -68,8 +71,11 @@ function GetPackageNode($package) {
6871
return [PSCustomObject]@{
6972
name = $packageInfo.PackageTocHeader
7073
href = $packageInfo.PackageLevelReadmeHref
71-
# This is always one package and it must be an array
72-
children = $packageInfo.TocChildren
74+
# This is always one package and it must be an array.
75+
# Cast to [string[]] to strip PSObject wrapping added by Sort-Object,
76+
# which causes ConvertTo-Yaml to serialize string properties (e.g. Length)
77+
# instead of string values.
78+
children = [string[]]$packageInfo.TocChildren
7379
};
7480
}
7581

0 commit comments

Comments
 (0)