diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java index 826dacb7127..d1679a8f212 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java @@ -1563,9 +1563,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat if (pol.checkExists()) { if (we == null) { - if (fetcher == null) - throw new FHIRException("Resource resolution services not provided"); - we = fetcher.fetch(hostContext.appContext, ref); + if (fetcher == null) { + if (!refType.equals("contained")) + throw new FHIRException("Resource resolution services not provided"); + } else { + we = fetcher.fetch(hostContext.appContext, ref); + } } rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, we != null, "Unable to resolve resource '"+ref+"'"); }