Skip to content

Commit 8238730

Browse files
MrHinshrpollick
andauthored
Add exclusions for work item types in validation (#2898)
- Implemented a check in TfsValidateRequiredFieldTool.cs to skip validation for excluded work item types, with debug logging. - Added an `Exclusions` property in TfsValidateRequiredFieldToolOptions.cs to allow users to specify work item types to exclude from validation, including documentation on its usage. - Removed deprecated commented-out code related to configuration validation in TfsValidateRequiredFieldTool.cs. Resolves: #2897 Co-authored-by: rpollick <[email protected]>
2 parents bac0e42 + 7307c07 commit 8238730

13 files changed

+636
-521
lines changed

appsettings.json

Lines changed: 495 additions & 490 deletions
Large diffs are not rendered by default.

docs/data/classes/reference.endpoints.tfsendpoint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ options:
116116
defaultValue: missing XML code comments
117117
status: missing XML code comments
118118
processingTarget: missing XML code comments
119-
classFile: src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsEndpoint.cs
120-
optionsClassFile: src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsEndpointOptions.cs
119+
classFile: src/MigrationTools.Clients.TfsObjectModel/EndPoints/TfsEndpoint.cs
120+
optionsClassFile: src/MigrationTools.Clients.TfsObjectModel/EndPoints/TfsEndpointOptions.cs

docs/data/classes/reference.endpoints.tfsteamprojectendpoint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,5 @@ options:
112112
defaultValue: missing XML code comments
113113
status: missing XML code comments
114114
processingTarget: missing XML code comments
115-
classFile: src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsTeamProjectEndpoint.cs
115+
classFile: src/MigrationTools.Clients.TfsObjectModel/EndPoints/TfsTeamProjectEndpoint.cs
116116
optionsClassFile: src/MigrationTools.Clients.TfsObjectModel/EndPoints/TfsTeamProjectEndPointOptions.cs

docs/data/classes/reference.endpoints.tfsteamsettingsendpoint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ options:
5353
defaultValue: missing XML code comments
5454
status: missing XML code comments
5555
processingTarget: missing XML code comments
56-
classFile: src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsTeamSettingsEndpoint.cs
57-
optionsClassFile: src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsTeamSettingsEndpointOptions.cs
56+
classFile: src/MigrationTools.Clients.TfsObjectModel/EndPoints/TfsTeamSettingsEndpoint.cs
57+
optionsClassFile: src/MigrationTools.Clients.TfsObjectModel/EndPoints/TfsTeamSettingsEndpointOptions.cs

docs/data/classes/reference.endpoints.tfsworkitemendpoint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ options:
5858
defaultValue: missing XML code comments
5959
status: missing XML code comments
6060
processingTarget: missing XML code comments
61-
classFile: src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsWorkItemEndpoint.cs
62-
optionsClassFile: src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsWorkItemEndpointOptions.cs
61+
classFile: src/MigrationTools.Clients.TfsObjectModel/EndPoints/TfsWorkItemEndpoint.cs
62+
optionsClassFile: src/MigrationTools.Clients.TfsObjectModel/EndPoints/TfsWorkItemEndpointOptions.cs

docs/data/classes/reference.processors.keepoutboundlinktargetprocessor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ configurationSamples:
2020
"Enabled": false,
2121
"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'",
2222
"TargetLinksToKeepOrganization": "https://dev.azure.com/nkdagility",
23-
"TargetLinksToKeepProject": "c0eff8c5-0c42-4f6a-9b7d-f892eeaf7ad5",
23+
"TargetLinksToKeepProject": "10464ecf-816d-4fca-a547-81f230b9069a",
2424
"CleanupFileName": "c:/temp/OutboundLinkTargets.bat",
2525
"PrependCommand": "start",
2626
"DryRun": true,

docs/data/classes/reference.tools.tfsvalidaterequiredfieldtool.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,35 @@ configurationSamples:
99
- name: sample
1010
order: 1
1111
description:
12-
code: There is no sample, but you can check the classic below for a general feel.
12+
code: >-
13+
{
14+
"MigrationTools": {
15+
"Version": "16.0",
16+
"CommonTools": {
17+
"TfsValidateRequiredFieldTool": {
18+
"Enabled": "True",
19+
"Exclusions": [
20+
"Work Request",
21+
"Opertunity",
22+
"Assumption"
23+
]
24+
}
25+
}
26+
}
27+
}
1328
sampleFor: MigrationTools.Tools.TfsValidateRequiredFieldToolOptions
1429
- name: classic
1530
order: 3
1631
description:
1732
code: >-
1833
{
1934
"$type": "TfsValidateRequiredFieldToolOptions",
20-
"Enabled": false
35+
"Enabled": true,
36+
"Exclusions": [
37+
"Work Request",
38+
"Opertunity",
39+
"Assumption"
40+
]
2141
}
2242
sampleFor: MigrationTools.Tools.TfsValidateRequiredFieldToolOptions
2343
description: Tool for validating that required fields exist in target work item types before migration, preventing migration failures due to missing required fields.
@@ -28,6 +48,10 @@ options:
2848
type: Boolean
2949
description: If set to `true` then the tool will run. Set to `false` and the processor will not run.
3050
defaultValue: missing XML code comments
51+
- parameterName: Exclusions
52+
type: List
53+
description: 'Add a list of work item types from the source that you want to exclude from validation. This is a case-insensitive comparison. WARNING: If you exclude a work item type that exists in the migration dataset, the migration will fail when trying to.'
54+
defaultValue: '[]'
3155
status: missing XML code comments
3256
processingTarget: missing XML code comments
3357
classFile: src/MigrationTools.Clients.TfsObjectModel/Tools/TfsValidateRequiredFieldTool.cs
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
optionsClassName: TfsWorkItemTypeValidatorToolOptions
2+
optionsClassFullName: MigrationTools.Tools.TfsWorkItemTypeValidatorToolOptions
3+
configurationSamples:
4+
- name: defaults
5+
order: 2
6+
description:
7+
code: There are no defaults! Check the sample for options!
8+
sampleFor: MigrationTools.Tools.TfsWorkItemTypeValidatorToolOptions
9+
- name: sample
10+
order: 1
11+
description:
12+
code: There is no sample, but you can check the classic below for a general feel.
13+
sampleFor: MigrationTools.Tools.TfsWorkItemTypeValidatorToolOptions
14+
- name: classic
15+
order: 3
16+
description:
17+
code: >-
18+
{
19+
"$type": "TfsWorkItemTypeValidatorToolOptions",
20+
"Enabled": true,
21+
"IncludeWorkItemtypes": [],
22+
"FieldMappings": {}
23+
}
24+
sampleFor: MigrationTools.Tools.TfsWorkItemTypeValidatorToolOptions
25+
description: missing XML code comments
26+
className: TfsWorkItemTypeValidatorTool
27+
typeName: Tools
28+
options:
29+
- parameterName: Enabled
30+
type: Boolean
31+
description: If set to `true` then the tool will run. Set to `false` and the processor will not run.
32+
defaultValue: missing XML code comments
33+
- parameterName: FieldMappings
34+
type: Dictionary
35+
description: Field reference name mappings. Key is work item type name, value is dictionary of mapping source filed name to target field name. Target field name can be empty string to indicate that this field will not be validated in target. As work item type name, you can use * to define mappings which will be applied to all work item types.
36+
defaultValue: missing XML code comments
37+
- parameterName: IncludeWorkItemtypes
38+
type: List
39+
description: List of work item types which will be validated. If this list is empty, all work item types will be validated.
40+
defaultValue: missing XML code comments
41+
status: missing XML code comments
42+
processingTarget: missing XML code comments
43+
classFile: src/MigrationTools.Clients.TfsObjectModel/Tools/TfsWorkItemTypeValidatorTool.cs
44+
optionsClassFile: src/MigrationTools.Clients.TfsObjectModel/Tools/TfsWorkItemTypeValidatorToolOptions.cs

docs/static/schema/configuration.schema.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,11 @@
14291429
"enabled": {
14301430
"description": "If set to `true` then the tool will run. Set to `false` and the processor will not run.",
14311431
"type": "boolean"
1432+
},
1433+
"exclusions": {
1434+
"description": "Add a list of work item types from the source that you want to exclude from validation. This is a case-insensitive comparison. WARNING: If you exclude a work item type that exists in the migration dataset, the migration will fail when trying to.",
1435+
"type": "array",
1436+
"default": "[]"
14321437
}
14331438
}
14341439
},
@@ -1463,6 +1468,25 @@
14631468
}
14641469
}
14651470
},
1471+
"tfsworkitemtypevalidatortool": {
1472+
"title": "TfsWorkItemTypeValidatorTool",
1473+
"description": "missing XML code comments",
1474+
"type": "object",
1475+
"properties": {
1476+
"enabled": {
1477+
"description": "If set to `true` then the tool will run. Set to `false` and the processor will not run.",
1478+
"type": "boolean"
1479+
},
1480+
"fieldMappings": {
1481+
"description": "Field reference name mappings. Key is work item type name, value is dictionary of mapping source filed name to target field name. Target field name can be empty string to indicate that this field will not be validated in target. As work item type name, you can use * to define mappings which will be applied to all work item types.",
1482+
"type": "object"
1483+
},
1484+
"includeWorkItemtypes": {
1485+
"description": "List of work item types which will be validated. If this list is empty, all work item types will be validated.",
1486+
"type": "array"
1487+
}
1488+
}
1489+
},
14661490
"workitemtypemappingtool": {
14671491
"title": "WorkItemTypeMappingTool",
14681492
"description": "Provides mapping functionality for transforming work item types from source to target systems during migration, allowing different work item type names to be used in the target.",

docs/static/schema/schema.tools.tfsvalidaterequiredfieldtool.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"enabled": {
99
"description": "If set to `true` then the tool will run. Set to `false` and the processor will not run.",
1010
"type": "boolean"
11+
},
12+
"exclusions": {
13+
"description": "Add a list of work item types from the source that you want to exclude from validation. This is a case-insensitive comparison. WARNING: If you exclude a work item type that exists in the migration dataset, the migration will fail when trying to.",
14+
"type": "array",
15+
"default": "[]"
1116
}
1217
}
1318
}

0 commit comments

Comments
 (0)