Open KeironO opened 3 weeks ago
I've double checked, and it looks to be an issue with the Validator.
package wales.nhs.ctmuhb;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.validation.*;
import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.common.hapi.validation.validator.*;
import org.hl7.fhir.common.hapi.validation.support.*;
import ca.uhn.fhir.context.support.*;
public class Main {
public static void main(String[] args) {
FhirContext ctx = FhirContext.forR4();
FhirValidator validator = ctx.newValidator();
ValidationSupportChain validationSupportChain = new ValidationSupportChain(
new DefaultProfileValidationSupport(ctx),
new InMemoryTerminologyServerValidationSupport(ctx),
new CommonCodeSystemsTerminologyService(ctx),
new SnapshotGeneratingValidationSupport(ctx));
FhirInstanceValidator instanceValidator = new FhirInstanceValidator(validationSupportChain);
validator.registerValidatorModule(instanceValidator);
Communication communication = new Communication();
communication.setStatus(Communication.CommunicationStatus.COMPLETED);
communication.setSender(new Reference("PractitionerRole?practitioner.identifier=myValue"));
ValidationResult result = validator.validateWithResult(communication);
if (result.isSuccessful()) {
System.out.println("Validation passed");
} else {
System.out.println("Validation failed");
result.getMessages().forEach(msg -> System.out.println(msg.getLocationString() + " " + msg.getMessage()));
}
}
}
Returns:
Validation failed
Communication.sender The query part of the conditional reference is not a valid query string (PractitionerRole?practitioner.identifier=myValue)
Describe the bug We are attempting to use chained parameters in match URLs within a FHIR resource (e.g.,
PractitionerRole?practitioner.identifier=myValue
), but HAPI FHIR is returning an error indicating that the query part of the conditional reference is not valid.To Reproduce Steps to reproduce the behavior:
PractitionerRole?practitioner.identifier=myValue
.Minimal Example
This is a minimal
Communication
resource that demonstrates the issue:Expected behavior We expected the server to correctly process the chained parameter in the match URL, resolving the reference as
PractitionerRole
where the associatedpractitioner.identifier
matches the given value (myValue
).Error Response
The server returns the following error:
Environment (please complete the following information):
Additional context We are trying to use chained parameters to reference resources based on identifiers, which should be valid according to FHIR chaining rules. The issue may be related to how the query part of the reference is parsed and validated.