diff --git a/MigrationTools.sln b/MigrationTools.sln index 9be6031d3..587623990 100644 --- a/MigrationTools.sln +++ b/MigrationTools.sln @@ -24,6 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore + appsettings.json = appsettings.json configuration.json = configuration.json configuration2-wit.json = configuration2-wit.json configuration2.json = configuration2.json diff --git a/appsettings.json b/appsettings.json index 6e17c9661..5453c5908 100644 --- a/appsettings.json +++ b/appsettings.json @@ -14,7 +14,6 @@ "MigrationTools": { "EndpointDefaults": { "TfsEndpoint": { - "EndpointType": "TfsTeamProjectEndpoint", "Collection": "", "Project": "", "AllowCrossProjectLinking": false, @@ -34,7 +33,6 @@ } }, "TfsTeamProjectEndpoint": { - "EndpointType": "TfsTeamProjectEndpoint", "Collection": "", "Project": "", "AllowCrossProjectLinking": false, @@ -56,7 +54,6 @@ }, "EndpointSamples": { "TfsTeamProjectEndpoint": { - "EndpointType": "TfsTeamProjectEndpoint", "Collection": "https://dev.azure.com/nkdagility-preview/", "Project": "migrationSource1", "AllowCrossProjectLinking": false, @@ -75,7 +72,6 @@ } }, "TfsEndpoint": { - "EndpointType": "TfsTeamProjectEndpoint", "Collection": "https://dev.azure.com/nkdagility-preview/", "Project": "migrationSource1", "AllowCrossProjectLinking": false, @@ -94,7 +90,6 @@ } }, "AzureDevOpsEndpoint": { - "EndpointType": "AzureDevOpsEndpoint", "AuthenticationMode": "AccessToken", "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", "Organisation": "https://dev.azure.com/xxx/", diff --git a/docs/Reference/Generated/MigrationTools.xml b/docs/Reference/Generated/MigrationTools.xml index 95463a30a..bb9d5cb61 100644 --- a/docs/Reference/Generated/MigrationTools.xml +++ b/docs/Reference/Generated/MigrationTools.xml @@ -263,17 +263,17 @@ - => @"c1dc8d13" + => @"76c49c7b" - => @"c1dc8d13597a011053009949861c3795a12918d7" + => @"76c49c7bd212b11211a22924e6ad4e36339739b8" - => @"2024-09-16T00:32:00+01:00" + => @"2024-09-16T00:57:48+01:00" @@ -283,12 +283,12 @@ - => @"v16.0.4-Preview.1" + => @"v16.0.4-Preview.2" - => @"v16.0.4-Preview.1" + => @"v16.0.4-Preview.2" @@ -323,12 +323,12 @@ - => @"Preview.1" + => @"Preview.2" - => @"-Preview.1" + => @"-Preview.2" diff --git a/docs/_data/reference.endpoints.azuredevopsendpoint.yaml b/docs/_data/reference.endpoints.azuredevopsendpoint.yaml index cc0659ad6..3357ed5ae 100644 --- a/docs/_data/reference.endpoints.azuredevopsendpoint.yaml +++ b/docs/_data/reference.endpoints.azuredevopsendpoint.yaml @@ -13,13 +13,11 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "AzureDevOpsEndpoint": { - "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", - "AuthenticationMode": "AccessToken", - "EndpointType": "AzureDevOpsEndpoint", - "Organisation": "https://dev.azure.com/xxx/", - "Project": "myProject" - } + "EndpointType": "AzureDevOpsEndpoint", + "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", + "AuthenticationMode": "AccessToken", + "Organisation": "https://dev.azure.com/xxx/", + "Project": "myProject" } } } diff --git a/docs/_data/reference.endpoints.tfsendpoint.yaml b/docs/_data/reference.endpoints.tfsendpoint.yaml index 58d87454f..689427f9a 100644 --- a/docs/_data/reference.endpoints.tfsendpoint.yaml +++ b/docs/_data/reference.endpoints.tfsendpoint.yaml @@ -9,26 +9,24 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "TfsEndpoint": { - "AllowCrossProjectLinking": "False", - "Authentication": { - "AccessToken": "", - "AuthenticationMode": "AccessToken", - "NetworkCredentials": { - "Domain": "", - "Password": "", - "UserName": "" - } - }, + "EndpointType": "TfsEndpoint", + "AllowCrossProjectLinking": "False", + "Authentication": { + "AccessToken": "", "AuthenticationMode": "AccessToken", - "Collection": "", - "EndpointType": "TfsTeamProjectEndpoint", - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" - }, - "Project": "" - } + "NetworkCredentials": { + "Domain": "", + "Password": "", + "UserName": "" + } + }, + "AuthenticationMode": "AccessToken", + "Collection": "", + "LanguageMaps": { + "AreaPath": "Area", + "IterationPath": "Iteration" + }, + "Project": "" } } } @@ -42,25 +40,23 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "TfsEndpoint": { - "AllowCrossProjectLinking": "False", - "Authentication": { - "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", - "AuthenticationMode": "AccessToken", - "NetworkCredentials": { - "Domain": "", - "Password": "", - "UserName": "" - } - }, - "Collection": "https://dev.azure.com/nkdagility-preview/", - "EndpointType": "TfsTeamProjectEndpoint", - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" - }, - "Project": "migrationSource1" - } + "EndpointType": "TfsEndpoint", + "AllowCrossProjectLinking": "False", + "Authentication": { + "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", + "AuthenticationMode": "AccessToken", + "NetworkCredentials": { + "Domain": "", + "Password": "", + "UserName": "" + } + }, + "Collection": "https://dev.azure.com/nkdagility-preview/", + "LanguageMaps": { + "AreaPath": "Area", + "IterationPath": "Iteration" + }, + "Project": "migrationSource1" } } } diff --git a/docs/_data/reference.endpoints.tfsteamprojectendpoint.yaml b/docs/_data/reference.endpoints.tfsteamprojectendpoint.yaml index 23d2571ec..0bbbfdd55 100644 --- a/docs/_data/reference.endpoints.tfsteamprojectendpoint.yaml +++ b/docs/_data/reference.endpoints.tfsteamprojectendpoint.yaml @@ -9,26 +9,24 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "TfsTeamProjectEndpoint": { - "AllowCrossProjectLinking": "False", - "Authentication": { - "AccessToken": "", - "AuthenticationMode": "AccessToken", - "NetworkCredentials": { - "Domain": "", - "Password": "", - "UserName": "" - } - }, + "EndpointType": "TfsTeamProjectEndpoint", + "AllowCrossProjectLinking": "False", + "Authentication": { + "AccessToken": "", "AuthenticationMode": "AccessToken", - "Collection": "", - "EndpointType": "TfsTeamProjectEndpoint", - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" - }, - "Project": "" - } + "NetworkCredentials": { + "Domain": "", + "Password": "", + "UserName": "" + } + }, + "AuthenticationMode": "AccessToken", + "Collection": "", + "LanguageMaps": { + "AreaPath": "Area", + "IterationPath": "Iteration" + }, + "Project": "" } } } @@ -42,25 +40,23 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "TfsTeamProjectEndpoint": { - "AllowCrossProjectLinking": "False", - "Authentication": { - "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", - "AuthenticationMode": "AccessToken", - "NetworkCredentials": { - "Domain": "", - "Password": "", - "UserName": "" - } - }, - "Collection": "https://dev.azure.com/nkdagility-preview/", - "EndpointType": "TfsTeamProjectEndpoint", - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" - }, - "Project": "migrationSource1" - } + "EndpointType": "TfsTeamProjectEndpoint", + "AllowCrossProjectLinking": "False", + "Authentication": { + "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", + "AuthenticationMode": "AccessToken", + "NetworkCredentials": { + "Domain": "", + "Password": "", + "UserName": "" + } + }, + "Collection": "https://dev.azure.com/nkdagility-preview/", + "LanguageMaps": { + "AreaPath": "Area", + "IterationPath": "Iteration" + }, + "Project": "migrationSource1" } } } diff --git a/docs/_data/reference.processors.keepoutboundlinktargetprocessor.yaml b/docs/_data/reference.processors.keepoutboundlinktargetprocessor.yaml index d203675d1..717c03949 100644 --- a/docs/_data/reference.processors.keepoutboundlinktargetprocessor.yaml +++ b/docs/_data/reference.processors.keepoutboundlinktargetprocessor.yaml @@ -17,7 +17,7 @@ configurationSamples: "Enabled": false, "WIQLQuery": "Select [System.Id] From WorkItems Where [System.TeamProject] = @project and not [System.WorkItemType] contains 'Test Suite, Test Plan,Shared Steps,Shared Parameter,Feedback Request'", "TargetLinksToKeepOrganization": "https://dev.azure.com/nkdagility", - "TargetLinksToKeepProject": "8e55d369-07c8-4e19-9313-fd2543544c73", + "TargetLinksToKeepProject": "cf9756e9-69e6-4c9a-b8f4-f4f620151478", "CleanupFileName": "c:/temp/OutboundLinkTargets.bat", "PrependCommand": "start", "DryRun": true, diff --git a/docs/collections/_reference/reference.endpoints.azuredevopsendpoint.md b/docs/collections/_reference/reference.endpoints.azuredevopsendpoint.md index 6f287688e..b99bbc26f 100644 --- a/docs/collections/_reference/reference.endpoints.azuredevopsendpoint.md +++ b/docs/collections/_reference/reference.endpoints.azuredevopsendpoint.md @@ -14,13 +14,11 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "AzureDevOpsEndpoint": { - "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", - "AuthenticationMode": "AccessToken", - "EndpointType": "AzureDevOpsEndpoint", - "Organisation": "https://dev.azure.com/xxx/", - "Project": "myProject" - } + "EndpointType": "AzureDevOpsEndpoint", + "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", + "AuthenticationMode": "AccessToken", + "Organisation": "https://dev.azure.com/xxx/", + "Project": "myProject" } } } diff --git a/docs/collections/_reference/reference.endpoints.tfsendpoint.md b/docs/collections/_reference/reference.endpoints.tfsendpoint.md index 54535a75a..f77eb6590 100644 --- a/docs/collections/_reference/reference.endpoints.tfsendpoint.md +++ b/docs/collections/_reference/reference.endpoints.tfsendpoint.md @@ -10,26 +10,24 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "TfsEndpoint": { - "AllowCrossProjectLinking": "False", - "Authentication": { - "AccessToken": "", - "AuthenticationMode": "AccessToken", - "NetworkCredentials": { - "Domain": "", - "Password": "", - "UserName": "" - } - }, + "EndpointType": "TfsEndpoint", + "AllowCrossProjectLinking": "False", + "Authentication": { + "AccessToken": "", "AuthenticationMode": "AccessToken", - "Collection": "", - "EndpointType": "TfsTeamProjectEndpoint", - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" - }, - "Project": "" - } + "NetworkCredentials": { + "Domain": "", + "Password": "", + "UserName": "" + } + }, + "AuthenticationMode": "AccessToken", + "Collection": "", + "LanguageMaps": { + "AreaPath": "Area", + "IterationPath": "Iteration" + }, + "Project": "" } } } @@ -43,25 +41,23 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "TfsEndpoint": { - "AllowCrossProjectLinking": "False", - "Authentication": { - "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", - "AuthenticationMode": "AccessToken", - "NetworkCredentials": { - "Domain": "", - "Password": "", - "UserName": "" - } - }, - "Collection": "https://dev.azure.com/nkdagility-preview/", - "EndpointType": "TfsTeamProjectEndpoint", - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" - }, - "Project": "migrationSource1" - } + "EndpointType": "TfsEndpoint", + "AllowCrossProjectLinking": "False", + "Authentication": { + "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", + "AuthenticationMode": "AccessToken", + "NetworkCredentials": { + "Domain": "", + "Password": "", + "UserName": "" + } + }, + "Collection": "https://dev.azure.com/nkdagility-preview/", + "LanguageMaps": { + "AreaPath": "Area", + "IterationPath": "Iteration" + }, + "Project": "migrationSource1" } } } diff --git a/docs/collections/_reference/reference.endpoints.tfsteamprojectendpoint.md b/docs/collections/_reference/reference.endpoints.tfsteamprojectendpoint.md index ae441a662..61db56810 100644 --- a/docs/collections/_reference/reference.endpoints.tfsteamprojectendpoint.md +++ b/docs/collections/_reference/reference.endpoints.tfsteamprojectendpoint.md @@ -10,26 +10,24 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "TfsTeamProjectEndpoint": { - "AllowCrossProjectLinking": "False", - "Authentication": { - "AccessToken": "", - "AuthenticationMode": "AccessToken", - "NetworkCredentials": { - "Domain": "", - "Password": "", - "UserName": "" - } - }, + "EndpointType": "TfsTeamProjectEndpoint", + "AllowCrossProjectLinking": "False", + "Authentication": { + "AccessToken": "", "AuthenticationMode": "AccessToken", - "Collection": "", - "EndpointType": "TfsTeamProjectEndpoint", - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" - }, - "Project": "" - } + "NetworkCredentials": { + "Domain": "", + "Password": "", + "UserName": "" + } + }, + "AuthenticationMode": "AccessToken", + "Collection": "", + "LanguageMaps": { + "AreaPath": "Area", + "IterationPath": "Iteration" + }, + "Project": "" } } } @@ -43,25 +41,23 @@ configurationSamples: "Version": "16.0", "Endpoints": { "#KEY#": { - "TfsTeamProjectEndpoint": { - "AllowCrossProjectLinking": "False", - "Authentication": { - "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", - "AuthenticationMode": "AccessToken", - "NetworkCredentials": { - "Domain": "", - "Password": "", - "UserName": "" - } - }, - "Collection": "https://dev.azure.com/nkdagility-preview/", - "EndpointType": "TfsTeamProjectEndpoint", - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" - }, - "Project": "migrationSource1" - } + "EndpointType": "TfsTeamProjectEndpoint", + "AllowCrossProjectLinking": "False", + "Authentication": { + "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", + "AuthenticationMode": "AccessToken", + "NetworkCredentials": { + "Domain": "", + "Password": "", + "UserName": "" + } + }, + "Collection": "https://dev.azure.com/nkdagility-preview/", + "LanguageMaps": { + "AreaPath": "Area", + "IterationPath": "Iteration" + }, + "Project": "migrationSource1" } } } diff --git a/docs/collections/_reference/reference.processors.keepoutboundlinktargetprocessor.md b/docs/collections/_reference/reference.processors.keepoutboundlinktargetprocessor.md index a11c664c9..8ddf12384 100644 --- a/docs/collections/_reference/reference.processors.keepoutboundlinktargetprocessor.md +++ b/docs/collections/_reference/reference.processors.keepoutboundlinktargetprocessor.md @@ -18,7 +18,7 @@ configurationSamples: "Enabled": false, "WIQLQuery": "Select [System.Id] From WorkItems Where [System.TeamProject] = @project and not [System.WorkItemType] contains 'Test Suite, Test Plan,Shared Steps,Shared Parameter,Feedback Request'", "TargetLinksToKeepOrganization": "https://dev.azure.com/nkdagility", - "TargetLinksToKeepProject": "8e55d369-07c8-4e19-9313-fd2543544c73", + "TargetLinksToKeepProject": "cf9756e9-69e6-4c9a-b8f4-f4f620151478", "CleanupFileName": "c:/temp/OutboundLinkTargets.bat", "PrependCommand": "start", "DryRun": true, diff --git a/src/MigrationTools.ConsoleDataGenerator/ClassDataLoader.cs b/src/MigrationTools.ConsoleDataGenerator/ClassDataLoader.cs index aa888ab22..61cdc3086 100644 --- a/src/MigrationTools.ConsoleDataGenerator/ClassDataLoader.cs +++ b/src/MigrationTools.ConsoleDataGenerator/ClassDataLoader.cs @@ -150,6 +150,14 @@ private List populateOptions(object item, JObject joptions) static string ConvertSectionWithPathToJson(IConfiguration configuration, IConfigurationSection section, IOptions option = null) { var pathSegments = option == null ? section.Path.Split(':') : option.ConfigurationMetadata.PathToInstance.Split(':'); + + // If IsKeyed is true, we skip the lowest path segment + if (option != null && option.ConfigurationMetadata.IsKeyed && pathSegments.Length > 1) + { + pathSegments = pathSegments.Take(pathSegments.Length - 1).ToArray(); + } + + JObject root = new JObject(); JObject currentObject = root; @@ -198,7 +206,15 @@ static string ConvertSectionWithPathToJson(IConfiguration configuration, IConfig else { // Handle as a regular object - currentObject[key] = sectionObject; + JObject itemObject = sectionObject as JObject ?? new JObject(); + + // Add ObjectName and OptionFor if IsKeyed is true + if (option != null && option.ConfigurationMetadata.IsKeyed) + { + itemObject.AddFirst(new JProperty(option.ConfigurationMetadata.ObjectName, option.ConfigurationMetadata.OptionFor)); + } + + currentObject[key] = itemObject; } } }