Fix for where profile_element extension was being ignored when checking types after snapshot generation
This commit is contained in:
parent
b5419efcab
commit
71a19710a0
|
@ -661,10 +661,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
System.out.println(" "+ed.getId()+" = "+ed.getPath()+" : "+typeSummaryWithProfile(ed)+"["+ed.getMin()+".."+ed.getMax()+"]"+sliceSummary(ed)+" "+constraintSummary(ed));
|
||||
}
|
||||
}
|
||||
if (exception)
|
||||
throw new DefinitionException(msg);
|
||||
else
|
||||
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.VALUE, url, msg, ValidationMessage.IssueSeverity.ERROR));
|
||||
handleError(url, msg);
|
||||
}
|
||||
// hack around a problem in R4 definitions (somewhere?)
|
||||
for (ElementDefinition ed : derived.getSnapshot().getElement()) {
|
||||
|
@ -712,14 +709,20 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
if (ed.getPath().equals("Bundle.entry.response.outcome")) {
|
||||
wt = "OperationOutcome";
|
||||
}
|
||||
if (!sd.getType().equals(wt)) {
|
||||
boolean ok = isCompatibleType(wt, sd);
|
||||
String tt = sd.getType();
|
||||
boolean elementProfile = u.hasExtension(ToolingExtensions.EXT_PROFILE_ELEMENT);
|
||||
if (elementProfile) {
|
||||
ElementDefinition edt = sd.getSnapshot().getElementById(u.getExtensionString(ToolingExtensions.EXT_PROFILE_ELEMENT));
|
||||
if (edt == null) {
|
||||
handleError(url, "The profile "+u.getValue()+" has type "+sd.getType()+" which is not consistent with the stated type "+wt);
|
||||
} else {
|
||||
tt = edt.typeSummary();
|
||||
}
|
||||
}
|
||||
if (!tt.equals(wt)) {
|
||||
boolean ok = !elementProfile && isCompatibleType(wt, sd);
|
||||
if (!ok) {
|
||||
String smsg = "The profile "+u.getValue()+" has type "+sd.getType()+" which is not consistent with the stated type "+wt;
|
||||
if (exception)
|
||||
throw new DefinitionException(smsg);
|
||||
else
|
||||
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.VALUE, url+"#"+ed.getId(), smsg, IssueSeverity.ERROR));
|
||||
handleError(url, "The profile "+u.getValue()+" has type "+sd.getType()+" which is not consistent with the stated type "+wt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -738,6 +741,13 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
private void handleError(String url, String msg) {
|
||||
if (exception)
|
||||
throw new DefinitionException(msg);
|
||||
else
|
||||
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.VALUE, url, msg, ValidationMessage.IssueSeverity.ERROR));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue