Skip to content

Absent validation for composite SearchParameter components types #4888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
volodymyr-korzh opened this issue May 15, 2023 · 0 comments · Fixed by #4909
Closed

Absent validation for composite SearchParameter components types #4888

volodymyr-korzh opened this issue May 15, 2023 · 0 comments · Fixed by #4909
Assignees

Comments

@volodymyr-korzh
Copy link
Collaborator

volodymyr-korzh commented May 15, 2023

Composite SearchParameter’s can only be composed out of the following 4 types of basic SearchParameter definitions: STRING, TOKEN, DATE, QUANTITY
But now it is possible to create composite SearchParameter with any type.

Steps To Reproduce

  1. Create a SearchParameter based on a "type": "token".
  2. Create another SearchParameter based on a "type": "reference".
  3. Create a Composite SearchParameter which uses both of the above in its "component" definition.
  4. If you try and use this Composite SearchParameter in a GET Request, you will get the following ERROR Response:
{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "processing",
            "diagnostics": "HAPI-1204: Don't know how to handle composite parameter with type of REFERENCE"
        }
    ]
}
Requests Example:
  1. PUT {Server_URL}/SearchParameter/observation-code
{
	"resourceType": "SearchParameter",
	"id": "observation-code",
	"url": "http://hl7.org/fhir/SearchParameter/Observation-code",
	"status": "active",
	"code": "observation-code",
	"base": [
		"Observation"
	],
	"type": "token",
	"expression": "Observation.code"
}
  1. PUT {Server_URL}/SearchParameter/observation-patient
{
	"resourceType": "SearchParameter",
	"id": "observation-patient",
	"url": "http://hl7.org/fhir/SearchParameter/Observation-patient",
	"status": "active",
	"description": "The subject that the observation is about (if patient)",
	"code": "observation-patient",
	"base": [
		"Observation"
	],
	"type": "reference",
	"expression": "Observation.subject.where(resolve() is Patient)",
	"target": [
		"Patient"
	]
}
  1. POST {Server_URL}/SearchParameter
{
	"resourceType": "SearchParameter",
	"extension": [
		{
			"url": "http://hapifhir.io/fhir/StructureDefinition/sp-unique",
			"valueBoolean": false
		}
	],
	"status": "active",
	"code": "patient-code",
	"base": [
		"Observation",
		"Patient"
	],
	"type": "composite",
	"expression": "Observation",
	"component": [
		{
			"definition": "SearchParameter/observation-code",
			"expression": "Observation"
		},
		{
			"definition": "SearchParameter/observation-patient",
			"expression": "Observation"
		}
	]
}
  1. GET {Server_URL}//Observation?patient-code:code$loinc|8302-2,value$1409

Actual result
Composite search parameter with "reference" component created successfully, but composite search query fails in runtime.
Expected behavior
Creation of Composite search parameter with "reference" component should be prohibited.

@volodymyr-korzh volodymyr-korzh self-assigned this May 15, 2023
@volodymyr-korzh volodymyr-korzh changed the title Draft: Composite SearchParameter Creation Drops Component Definition Property Absent validation for composite SearchParameter components types May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant