Skip to content

Commit

Permalink
Fix several places which needs to add group id property (#27713)
Browse files Browse the repository at this point in the history
Co-authored-by: sima-zhu <[email protected]>
  • Loading branch information
azure-sdk and sima-zhu authored Mar 16, 2022
1 parent b95cd40 commit 0ddca11
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions eng/common/scripts/Update-DocsMsToc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,26 @@ for ($i = 0; $i -lt $metadata.Count; $i++) {
Write-Host "File metadata already added for $($metadata[$i].Package). Keeping the first entry found."
continue
}

Add-Member `
-InputObject $metadata[$i] `
-MemberType NoteProperty `
-Name FileMetadata `
-Value $fileEntry
if (!($metadata[$i].PSObject.Members.Name -contains "GroupId") -or ($fileEntry.Group -eq $metadata[$i].GroupId)) {
Add-Member `
-InputObject $metadata[$i] `
-MemberType NoteProperty `
-Name FileMetadata `
-Value $fileEntry
}
}
}
}

$packagesForToc = @{}
foreach ($metadataEntry in (GetPackageLookup $metadata).Values) {
$allPackages = GetPackageLookup $metadata
foreach ($metadataKey in $allPackages.Keys) {
$metadataEntry = $allPackages[$metadataKey]
if (!$metadataEntry.ServiceName) {
LogWarning "Empty ServiceName for package `"$($metadataEntry.Package)`". Skipping."
LogWarning "Empty ServiceName for package `"$metadataKey`". Skipping."
continue
}
$packagesForToc[$metadataEntry.Package] = $metadataEntry
$packagesForToc[$metadataKey] = $metadataEntry
}

# Get unique service names and sort alphabetically to act as the service nodes
Expand All @@ -183,7 +186,7 @@ foreach ($service in $serviceNameList) {

# Client packages get individual entries
$clientPackages = $packagesForToc.Values.Where({ $_.ServiceName -eq $service -and ('client' -eq $_.Type) })
$clientPackages = $clientPackages | Sort-Object -Property Package
$clientPackages = $clientPackages | Sort-Object 'Package', 'GroupId' | Get-Unique
if ($clientPackages) {
foreach ($clientPackage in $clientPackages) {
$packageItems += GetClientPackageNode -clientPackage $clientPackage
Expand Down

0 comments on commit 0ddca11

Please sign in to comment.