From 7ad45308e082659dc11727581af49df481750713 Mon Sep 17 00:00:00 2001 From: Matti Uusitalo Date: Mon, 17 Dec 2018 14:10:15 +0200 Subject: [PATCH] Make this configurable --- .../dstu3/hapi/validation/FhirInstanceValidator.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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<>();