diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java index 967e8f55241..30e7a73d1ee 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java @@ -65,6 +65,8 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid private volatile WorkerContextWrapper myWrappedWorkerContext; private Function enableWhenEvaluatorSupplier = ctx -> new DefaultEnableWhenEvaluator(); + private boolean errorForUnknownProfiles; + /** * Constructor *

@@ -190,6 +192,14 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid public boolean isAnyExtensionsAllowed() { return myAnyExtensionsAllowed; } + + public boolean isErrorForUnknownProfiles() { + return errorForUnknownProfiles; + } + + public void setErrorForUnknownProfiles(boolean errorForUnknownProfiles) { + this.errorForUnknownProfiles = errorForUnknownProfiles; + } /** * If set to {@literal true} (default is true) extensions which are not known to the @@ -249,7 +259,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid v.setResourceIdRule(IdStatus.OPTIONAL); v.setNoTerminologyChecks(isNoTerminologyChecks()); v.setMyEnableWhenEvaluator(enableWhenEvaluatorSupplier.apply(wrappedWorkerContext)); - v.setErrorForUnknownProfiles(true); // TODO must be configurable instead of hardcoded to be always true + v.setErrorForUnknownProfiles(isErrorForUnknownProfiles()); List messages = new ArrayList<>();