Skip to content

Commit 04353ca

Browse files
authored
Fix field type validation – propagate result of validation (#2914)
Small fix to field type validation. I forgot to propagate result of field validation upper to the work item validation, so even if some fields were not valid, the whole work item type claimed it is valid.
2 parents aa70c63 + 67b8687 commit 04353ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/MigrationTools.Clients.TfsObjectModel/Tools/TfsWorkItemTypeValidatorTool.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private bool ValidateWorkItemTypeFields(WorkItemType sourceWit, WorkItemType tar
112112
}
113113
else
114114
{
115-
ValidateField(sourceField, targetFields[targetFieldName], targetWit.Name);
115+
result &= ValidateField(sourceField, targetFields[targetFieldName], targetWit.Name);
116116
}
117117
}
118118
else
@@ -135,7 +135,7 @@ private bool ValidateWorkItemTypeFields(WorkItemType sourceWit, WorkItemType tar
135135
return result;
136136
}
137137

138-
private void ValidateField(FieldDefinition sourceField, FieldDefinition targetField, string targetWitName)
138+
private bool ValidateField(FieldDefinition sourceField, FieldDefinition targetField, string targetWitName)
139139
{
140140
// If target field is in 'FixedTargetFields' list, it means, that user resolved this filed somehow.
141141
// For example by value mapping. So any discrepancies found will be logged just as information.
@@ -156,6 +156,7 @@ private void ValidateField(FieldDefinition sourceField, FieldDefinition targetFi
156156
+ $" because it is listed in '{nameof(Options.FixedTargetFields)}'.",
157157
targetField.ReferenceName, targetWitName, sourceField.ReferenceName);
158158
}
159+
return (logLevel == LogLevel.Information) || isValid;
159160
}
160161

161162
private bool ValidateFieldType(FieldDefinition sourceField, FieldDefinition targetField, LogLevel logLevel)

0 commit comments

Comments
 (0)