More fixes for SearchParameter validation

This commit is contained in:
Grahame Grieve 2023-12-12 21:00:31 +13:00
parent 289a74301d
commit 166cb445f8
2 changed files with 8 additions and 2 deletions

View File

@ -264,6 +264,7 @@ public class ToolingExtensions {
public static final String EXT_ARTIFACT_NAME = "http://hl7.org/fhir/StructureDefinition/artifact-name";
public static final String EXT_ARTIFACT_DESC = "http://hl7.org/fhir/StructureDefinition/artifact-description";
public static final String EXT_ED_SUPPRESS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-suppress";
public static final String EXT_SEARCH_PARAMETER_BASE = "http://hl7.org/fhir/tools/StructureDefinition/searchparameter-base-type";;
// specific extension helpers

View File

@ -12,6 +12,7 @@ import org.hl7.fhir.r5.fhirpath.ExpressionNode.Kind;
import org.hl7.fhir.r5.fhirpath.ExpressionNode.Operation;
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine.IssueMessage;
import org.hl7.fhir.r5.model.SearchParameter;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.utilities.validation.ValidationMessage;
@ -45,9 +46,13 @@ public class SearchParameterValidator extends BaseValidator {
if (cs.hasChild("expression", false)) {
List<String> bases = new ArrayList<>();
for (Element b : cs.getChildrenByName("base")) {
bases.add(b.primitiveValue());
if (b.hasExtension(ToolingExtensions.EXT_SEARCH_PARAMETER_BASE)) {
bases.add(b.getExtensionValue(ToolingExtensions.EXT_SEARCH_PARAMETER_BASE).primitiveValue());
} else {
bases.add(b.primitiveValue());
}
}
if (!bases.isEmpty()) {
if (!bases.isEmpty()) { // that'd be an error somewhere else
ok = checkExpression(errors, stack.push(cs.getNamedChild("expression", false), -1, null, null), cs.getNamedChildValue("expression", false), bases) && ok;
}
}