in Common/Validation/WorkItem/ValidateWorkItemTypes.cs [152:204]
private void ValidateWorkItemTypeFidelity(IValidationContext context, string type)
{
Logger.LogInformation($"Checking metadata for work item type {type}");
var matches = false;
var exists = false;
if (context.TargetTypesAndFields.ContainsKey(type) &&
context.SourceTypesAndFields.ContainsKey(type))
{
exists = true;
var targetWorkItemTypeFields = context.TargetTypesAndFields[type];
var sourceWorkItemTypeFields = context.SourceTypesAndFields[type];
matches = this.CompareWorkItemType(context, type, sourceWorkItemTypeFields, targetWorkItemTypeFields);
}
// Only log this once so not to overload the log
if (!matches && context.Config.SkipWorkItemsWithTypeMissingFields)
{
Logger.LogWarning("One or more work item types or fields do not exist in the target account. Please check the log for more details.");
}
//work item type does not exist. Log and continue since there is nothing we can do with it
if (!exists)
{
Logger.LogWarning(LogDestination.File, $"Work item type {type} does not exist on the target account and will be skipped");
context.SkippedTypes.Add(type);
}
else
{
// if skipping types with field mismatch, add it to the skipped list
if (!matches && context.Config.SkipWorkItemsWithTypeMissingFields)
{
Logger.LogWarning(LogDestination.File, $"Work item type {type} exists but has missing fields on the target account and will be skipped");
context.SkippedTypes.Add(type);
}
// otherwise mark it as validated so that we don't re-validate this type
else
{
if (!matches)
{
Logger.LogInformation($"Work item type {type} validation completed but has missing fields, please check the log for more details");
}
else
{
Logger.LogInformation($"Work item type {type} validation completed successfully");
}
context.ValidatedTypes.Add(type);
}
}
}