don't fail with an exception if an unknown resource type appears in contained resource

This commit is contained in:
Grahame Grieve 2021-06-15 08:48:19 +10:00
parent 0c609448f4
commit 435e0261e0
1 changed files with 7 additions and 5 deletions

View File

@ -366,13 +366,15 @@ public class JsonParser extends ParserBase {
} else { } else {
String name = rt.getAsString(); String name = rt.getAsString();
StructureDefinition sd = context.fetchResource(StructureDefinition.class, ProfileUtilities.sdNs(name, context.getOverrideVersionNs())); StructureDefinition sd = context.fetchResource(StructureDefinition.class, ProfileUtilities.sdNs(name, context.getOverrideVersionNs()));
if (sd == null) if (sd == null) {
throw new FHIRFormatError(context.formatMessage(I18nConstants.CONTAINED_RESOURCE_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_, name)); logError(line(res), col(res), npath, IssueType.INVALID, context.formatMessage(I18nConstants.CONTAINED_RESOURCE_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_, name), IssueSeverity.FATAL);
} else {
parent.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd, this.profileUtilities), SpecialElement.fromProperty(parent.getProperty()), elementProperty); parent.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd, this.profileUtilities), SpecialElement.fromProperty(parent.getProperty()), elementProperty);
parent.setType(name); parent.setType(name);
parseChildren(npath, res, parent, true); parseChildren(npath, res, parent, true);
} }
} }
}
private void reapComments(JsonObject object, Element context) { private void reapComments(JsonObject object, Element context) {
if (object.has("fhir_comments")) { if (object.has("fhir_comments")) {