After continuing to investigate this, I'm in a bind. I don't know what else to do.
As mentioned above, I have altered the validationSupportChain() method in StarterJpaConfig:
@Primary
@Bean
public CachingValidationSupport validationSupportChain(JpaValidationSupportChain theJpaValidationSupportChain, IFhirSystemDao<?, ?> fhirSystemDao) {
FhirContext ctx = fhirSystemDao.getContext();
DefaultProfileValidationSupport defaultSupport = new DefaultProfileValidationSupport(ctx);
theJpaValidationSupportChain.addValidationSupport(defaultSupport);
RemoteTerminologyServiceValidationSupport remoteTermSvc = new RemoteTerminologyServiceValidationSupport(ctx, "https://tx.fhir.org/r4");
theJpaValidationSupportChain.addValidationSupport(remoteTermSvc);
return ValidationSupportConfigUtil.newCachingValidationSupport(theJpaValidationSupportChain);
}
I have also added a new method to create a FhirInstanceModule:
@Primary
@Bean
public IValidatorModule validatorModule(CachingValidationSupport validationSupport) {
return new FhirInstanceValidator(validationSupport);
}
Logging confirms that this method uses the
CachingValidationSupport created by the first method. In
AppProperties.Validation, I set requests_enabled and responses_enabled
to true, so in the restfulServer method, the FhirInstanceValidator above
is injected in a RequestValidatingInterceptor, which is injected in the
RestfulServer.
if (validatorModule != null) {
if (appProperties.getValidation().getRequests_enabled()) {
RequestValidatingInterceptor interceptor = new RequestValidatingInterceptor();
interceptor.setFailOnSeverity(ResultSeverityEnum.ERROR);
interceptor.setValidatorModules(Collections.singletonList(validatorModule));
fhirServer.registerInterceptor(interceptor);
}
if (appProperties.getValidation().getResponses_enabled()) {
ResponseValidatingInterceptor interceptor = new ResponseValidatingInterceptor();
interceptor.setFailOnSeverity(ResultSeverityEnum.ERROR);
interceptor.setValidatorModules(Collections.singletonList(validatorModule));
fhirServer.registerInterceptor(interceptor);
}
}
But when testing this with a test file which should be validated by the https://tx.fhir.org/r4 server, it returns the same error as when using a DefaultProfileValidationSupport, except with a 422 http code.
Op woensdag 16 augustus 2023 om 14:49:01 UTC+2 schreef Xander: