Add setting for UnknownCodeSystemsCauseErrors + fix tests
This commit is contained in:
parent
30cf201b32
commit
df77506bf7
|
@ -228,7 +228,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
|
|||
encoded = encode(oo);
|
||||
ourLog.info(encoded);
|
||||
assertThat(oo.getIssue()).hasSize(1);
|
||||
assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code1' (error because this is a required binding)", oo.getIssueFirstRep().getDiagnostics());
|
||||
assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code1'", oo.getIssueFirstRep().getDiagnostics());
|
||||
assertEquals(OperationOutcome.IssueSeverity.WARNING, oo.getIssueFirstRep().getSeverity());
|
||||
|
||||
// Invalid code
|
||||
|
@ -334,7 +334,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
|
|||
encoded = encode(oo);
|
||||
ourLog.info(encoded);
|
||||
assertThat(oo.getIssue()).hasSize(1);
|
||||
assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code1' (error because this is a required binding)", oo.getIssueFirstRep().getDiagnostics());
|
||||
assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code1'", oo.getIssueFirstRep().getDiagnostics());
|
||||
assertEquals(OperationOutcome.IssueSeverity.WARNING, oo.getIssueFirstRep().getSeverity());
|
||||
|
||||
// Invalid code
|
||||
|
@ -343,7 +343,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
|
|||
encoded = encode(oo);
|
||||
ourLog.info(encoded);
|
||||
assertThat(oo.getIssue()).hasSize(1);
|
||||
assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code99' (error because this is a required binding)", oo.getIssue().get(0).getDiagnostics());
|
||||
assertEquals("CodeSystem is unknown and can't be validated: http://cs for 'http://cs#code99'", oo.getIssue().get(0).getDiagnostics());
|
||||
assertEquals(OperationOutcome.IssueSeverity.WARNING, oo.getIssue().get(0).getSeverity());
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
private boolean noBindingMsgSuppressed = false;
|
||||
private volatile VersionSpecificWorkerContextWrapper myWrappedWorkerContext;
|
||||
private boolean errorForUnknownProfiles = true;
|
||||
private boolean myUnknownSystemsCauseErrors = true;
|
||||
private boolean assumeValidRestReferences;
|
||||
private List<String> myExtensionDomains = Collections.emptyList();
|
||||
private IValidatorResourceFetcher validatorResourceFetcher;
|
||||
|
@ -132,6 +133,14 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
myBestPracticeWarningLevel = theBestPracticeWarningLevel;
|
||||
}
|
||||
|
||||
public void setUnknownSystemsCauseErrors(boolean theUnknownSystemsCauseErrors) {
|
||||
myUnknownSystemsCauseErrors = theUnknownSystemsCauseErrors;
|
||||
}
|
||||
|
||||
public boolean isUnknownSystemsCauseErrors() {
|
||||
return myUnknownSystemsCauseErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link IValidationSupport validation support} in use by this validator. Default is an instance of
|
||||
* DefaultProfileValidationSupport if the no-arguments constructor for this object was used.
|
||||
|
@ -229,6 +238,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
.setAnyExtensionsAllowed(isAnyExtensionsAllowed())
|
||||
.setBestPracticeWarningLevel(getBestPracticeWarningLevel())
|
||||
.setErrorForUnknownProfiles(isErrorForUnknownProfiles())
|
||||
.setUnknownSystemsCauseErrors(isUnknownSystemsCauseErrors())
|
||||
.setExtensionDomains(getExtensionDomains())
|
||||
.setValidationPolicyAdvisor(validatorPolicyAdvisor)
|
||||
.setNoTerminologyChecks(isNoTerminologyChecks())
|
||||
|
@ -239,6 +249,8 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
|
|||
.validate(wrappedWorkerContext, theValidationCtx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Nonnull
|
||||
protected VersionSpecificWorkerContextWrapper provideWorkerContext() {
|
||||
VersionSpecificWorkerContextWrapper wrappedWorkerContext = myWrappedWorkerContext;
|
||||
|
|
|
@ -47,6 +47,7 @@ class ValidatorWrapper {
|
|||
private boolean myAssumeValidRestReferences;
|
||||
private boolean myNoExtensibleWarnings;
|
||||
private boolean myNoBindingMsgSuppressed;
|
||||
private boolean myUnknownSystemsCauseErrors;
|
||||
private Collection<? extends String> myExtensionDomains;
|
||||
private IValidatorResourceFetcher myValidatorResourceFetcher;
|
||||
private IValidationPolicyAdvisor myValidationPolicyAdvisor;
|
||||
|
@ -82,6 +83,11 @@ class ValidatorWrapper {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ValidatorWrapper setUnknownSystemsCauseErrors(boolean theUnknownSystemsCauseErrors) {
|
||||
myUnknownSystemsCauseErrors = theUnknownSystemsCauseErrors;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValidatorWrapper setNoTerminologyChecks(boolean theNoTerminologyChecks) {
|
||||
myNoTerminologyChecks = theNoTerminologyChecks;
|
||||
return this;
|
||||
|
@ -129,6 +135,7 @@ class ValidatorWrapper {
|
|||
v.setResourceIdRule(IdStatus.OPTIONAL);
|
||||
v.setNoTerminologyChecks(myNoTerminologyChecks);
|
||||
v.setErrorForUnknownProfiles(myErrorForUnknownProfiles);
|
||||
v.setUnknownCodeSystemsCauseErrors(myUnknownSystemsCauseErrors);
|
||||
v.getExtensionDomains().addAll(myExtensionDomains);
|
||||
v.setFetcher(myValidatorResourceFetcher);
|
||||
v.setPolicyAdvisor(myValidationPolicyAdvisor);
|
||||
|
@ -136,6 +143,7 @@ class ValidatorWrapper {
|
|||
v.setNoBindingMsgSuppressed(myNoBindingMsgSuppressed);
|
||||
v.setAllowXsiLocation(true);
|
||||
|
||||
|
||||
List<ValidationMessage> messages = new ArrayList<>();
|
||||
|
||||
List<StructureDefinition> profiles = new ArrayList<>();
|
||||
|
|
Loading…
Reference in New Issue