Fix significant bug where validator gets internal child lists incorrect and doesn't do complete validation when switching between validating profiles and resources directly

This commit is contained in:
Grahame Grieve 2024-02-25 19:15:27 +11:00
parent df3456d293
commit 0642e123a1
1 changed files with 5 additions and 4 deletions

View File

@ -433,7 +433,7 @@ public class ProfileUtilities extends TranslatingUtilities {
private boolean wantFixDifferentialFirstElementType;
private Set<String> masterSourceFileNames;
private Set<String> localFileNames;
private Map<ElementDefinition, SourcedChildDefinitions> childMapCache = new HashMap<>();
private Map<String, SourcedChildDefinitions> childMapCache = new HashMap<>();
private AllowUnknownProfile allowUnknownProfile = AllowUnknownProfile.ALL_TYPES;
private MappingMergeModeOption mappingMergeMode = MappingMergeModeOption.APPEND;
private boolean forPublication;
@ -479,8 +479,9 @@ public class ProfileUtilities extends TranslatingUtilities {
}
public SourcedChildDefinitions getChildMap(StructureDefinition profile, ElementDefinition element) throws DefinitionException {
if (childMapCache.containsKey(element)) {
return childMapCache.get(element);
String cacheKey = "cm."+profile.getVersionedUrl()+"#"+(element.hasId() ? element.getId() : element.getPath());
if (childMapCache.containsKey(cacheKey)) {
return childMapCache.get(cacheKey);
}
StructureDefinition src = profile;
if (element.getContentReference() != null) {
@ -524,7 +525,7 @@ public class ProfileUtilities extends TranslatingUtilities {
break;
}
SourcedChildDefinitions result = new SourcedChildDefinitions(src, res);
childMapCache.put(element, result);
childMapCache.put(cacheKey, result);
return result;
}
}