Skip to content

Commit a0f7a82

Browse files
authored
Add Get-ClassTypeNameFromDataFile function and update documentation links (#2979)
This pull request primarily enhances how documentation URLs are generated in the `Get-DiscussionId.ps1` script by including the class type name in the URL path. It introduces a new function to extract the class type name from data files and updates all relevant code paths to use this value. Additionally, a minor metadata update is made to a documentation markdown file. **Improvements to documentation URL generation:** * Added a new function `Get-ClassTypeNameFromDataFile` to extract the `typeName` property from YAML data files, with error handling for missing or invalid files. (.powershell/docs/Get-DiscussionId.ps1) * Updated all references to data file paths to use the correct directory: `.\docs\data\classesThis pull request primarily enhances how documentation URLs are generated in the `Get-DiscussionId.ps1` script by including the class type name in the URL path. It introduces a new function to extract the class type name from data files and updates all relevant code paths to use this value. Additionally, a minor metadata update is made to a documentation markdown file. **Improvements to documentation URL generation:** * Added a new function `Get-ClassTypeNameFromDataFile` to extract the `typeName` property from YAML data files, with error handling for missing or invalid files. (.powershell/docs/Get-DiscussionId.ps1) instead of `.\docsThis pull request primarily enhances how documentation URLs are generated in the `Get-DiscussionId.ps1` script by including the class type name in the URL path. It introduces a new function to extract the class type name from data files and updates all relevant code paths to use this value. Additionally, a minor metadata update is made to a documentation markdown file. **Improvements to documentation URL generation:** * Added a new function `Get-ClassTypeNameFromDataFile` to extract the `typeName` property from YAML data files, with error handling for missing or invalid files. (.powershell/docs/Get-DiscussionId.ps1) . (.powershell/docs/Get-DiscussionId.ps1) [[1]](diffhunk://#diff-a57e4bef6b3d02f906acbc6ae2295862ef115ce58be8845e0d635d9d31e6d346R482-R486) [[2]](diffhunk://#diff-a57e4bef6b3d02f906acbc6ae2295862ef115ce58be8845e0d635d9d31e6d346R767-R772) * Modified the construction of documentation URLs to include the class type name as a path segment, ensuring URLs are more specific and organized. (.powershell/docs/Get-DiscussionId.ps1) [[1]](diffhunk://#diff-a57e4bef6b3d02f906acbc6ae2295862ef115ce58be8845e0d635d9d31e6d346L493-R517) [[2]](diffhunk://#diff-a57e4bef6b3d02f906acbc6ae2295862ef115ce58be8845e0d635d9d31e6d346L538-R562) [[3]](diffhunk://#diff-a57e4bef6b3d02f906acbc6ae2295862ef115ce58be8845e0d635d9d31e6d346L755-R781) * Ensured that the class type name is consistently extracted and used in both the main discussion creation logic and in the loop over markdown objects, including normalization to lowercase where appropriate. (.powershell/docs/Get-DiscussionId.ps1) **Documentation metadata update:** * Added a `discussionId` field to the front matter of `docs/content/docs/get-started/validation/index.md`.
2 parents 1073171 + e4f6c83 commit a0f7a82

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

.powershell/docs/Get-DiscussionId.ps1

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,28 @@ function Get-ClassNameFromDataFile {
418418
}
419419
}
420420

421+
# Function to get class name from data file
422+
function Get-ClassTypeNameFromDataFile {
423+
param(
424+
[string]$DataFilePath
425+
)
426+
427+
if (-not (Test-Path $DataFilePath)) {
428+
Write-WarningLog "Data file not found: $DataFilePath"
429+
return $null
430+
}
431+
432+
try {
433+
$yamlContent = Get-Content -Path $DataFilePath -Raw
434+
$data = ConvertFrom-Yaml -Yaml $yamlContent
435+
return $data.typeName
436+
}
437+
catch {
438+
Write-WarningLog "Failed to parse data file $DataFilePath : $($_.Exception.Message)"
439+
return $null
440+
}
441+
}
442+
421443
# Function to convert class name to friendly name
422444
function Convert-ClassNameToFriendlyName {
423445
param(
@@ -457,9 +479,11 @@ function Find-OrCreateDiscussion {
457479

458480
# Get class name from data file if available
459481
$className = $null
482+
$classTypeName = "unknown"
460483
if ($dataFile) {
461-
$dataFilePath = Join-Path ".\docs\" $dataFile
484+
$dataFilePath = Join-Path ".\docs\data\classes\" $dataFile
462485
$className = Get-ClassNameFromDataFile -DataFilePath $dataFilePath
486+
$classTypeName = Get-ClassTypeNameFromDataFile -DataFilePath $dataFilePath
463487
}
464488

465489
# Convert class name to friendly name
@@ -490,7 +514,7 @@ function Find-OrCreateDiscussion {
490514
# Generate updated discussion body to ensure consistency
491515
$docUrl = ""
492516
if ($hugoMarkdown.FrontMatter.slug) {
493-
$docUrl = "https://devopsmigration.io/docs/reference/$($hugoMarkdown.FrontMatter.slug)/"
517+
$docUrl = "https://devopsmigration.io/docs/reference/$classTypeName/$($hugoMarkdown.FrontMatter.slug)/"
494518
}
495519
elseif ($hugoMarkdown.ReferencePath) {
496520
$relativePath = $hugoMarkdown.ReferencePath.Replace('docs/', '').Replace('\', '/')
@@ -535,7 +559,7 @@ function Find-OrCreateDiscussion {
535559
# Generate documentation URL
536560
$docUrl = ""
537561
if ($hugoMarkdown.FrontMatter.slug) {
538-
$docUrl = "https://devopsmigration.io/docs/reference/$($hugoMarkdown.FrontMatter.slug)/"
562+
$docUrl = "https://devopsmigration.io/docs/reference/$classTypeName/$($hugoMarkdown.FrontMatter.slug)/"
539563
}
540564
elseif ($hugoMarkdown.ReferencePath) {
541565
$relativePath = $hugoMarkdown.ReferencePath.Replace('docs/', '').Replace('\', '/')
@@ -740,10 +764,12 @@ foreach ($hugoMarkdown in $hugoMarkdownObjects) {
740764
if ($existingDiscussion) {
741765
# Get class name from data file if available
742766
$className = $null
767+
$classTypeName = "unknown"
743768
$dataFile = $hugoMarkdown.FrontMatter.dataFile
744769
if ($dataFile) {
745-
$dataFilePath = Join-Path ".\docs\" $dataFile
770+
$dataFilePath = Join-Path ".\docs\data\classes\" $dataFile
746771
$className = Get-ClassNameFromDataFile -DataFilePath $dataFilePath
772+
$classTypeName = (Get-ClassTypeNameFromDataFile -DataFilePath $dataFilePath).ToLower()
747773
}
748774

749775
# Convert class name to friendly name
@@ -752,7 +778,7 @@ foreach ($hugoMarkdown in $hugoMarkdownObjects) {
752778
# Generate documentation URL
753779
$docUrl = ""
754780
if ($hugoMarkdown.FrontMatter.slug) {
755-
$docUrl = "https://devopsmigration.io/docs/reference/$($hugoMarkdown.FrontMatter.slug)/"
781+
$docUrl = "https://devopsmigration.io/docs/reference/$classTypeName/$($hugoMarkdown.FrontMatter.slug)/"
756782
}
757783
elseif ($hugoMarkdown.ReferencePath) {
758784
$relativePath = $hugoMarkdown.ReferencePath.Replace('\', '/')

docs/content/docs/get-started/validation/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: "Validating your Azure DevOps Migration Tools migration"
2+
title: Validating your Azure DevOps Migration Tools migration
33
description: This tutorial covers the steps to validate and verify your migration using the Azure DevOps Migration Tools.
44
short_title: Get Validated
55
weight: 10
66
aliases:
7-
- /validation/
7+
- /validation/
88
date: 2025-09-01T09:00:00Z
9+
discussionId: 2978
910

1011
---
11-
1212
The Azure DevOps Migration Tools use a two-step validation process to ensure a smooth and successful migration. This process helps catch configuration or data issues early, saving time and preventing unnecessary data loading when migration cannot proceed.
1313

1414
## 1. Pre-Data-Load Validation
@@ -36,4 +36,4 @@ By running validation both before and after data loading, the migration process
3636

3737
For more details on each validator, see their dedicated documentation pages:
3838
- [`TfsWorkItemTypeValidatorTool`]({{< ref "/docs/reference/tools/tfsworkitemtypevalidatortool/" >}})
39-
- [`TfsValidateRequiredFieldTool`]({{< ref "/docs/reference/tools/tfsvalidaterequiredfieldtool/" >}})
39+
- [`TfsValidateRequiredFieldTool`]({{< ref "/docs/reference/tools/tfsvalidaterequiredfieldtool/" >}})

0 commit comments

Comments
 (0)