From c913190d7a9fc925b6dc96449b5f0faa047a21b6 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 24 Nov 2023 08:53:09 +1100 Subject: [PATCH] validate that composite search parameters have components --- .../instance/type/SearchParameterValidator.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/SearchParameterValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/SearchParameterValidator.java index bbe2a9f7d..c7cb3a69e 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/SearchParameterValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/SearchParameterValidator.java @@ -67,11 +67,18 @@ public class SearchParameterValidator extends BaseValidator { String expThis = canonicalise(cs.getNamedChildValue("expression", false), bases); String expOther = canonicalise(sp.getExpression(), bases); warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE,stack.getLiteralPath(), expThis.equals(expOther), I18nConstants.SEARCHPARAMETER_EXP_WRONG, master, sp.getExpression(), cs.getNamedChildValue("expression", false)); - } - - // todo: check compositions + } } } + if ("composite".equals(cs.getNamedChildValue("type", false))) { + List components = cs.getChildren("component"); + if (rule(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, stack.getLiteralPath(), components.size() > 1, I18nConstants.SEARCHPARAMETER_MISSING_COMPONENTS)) { + // todo: check compositions + } else { + ok = false; + } + + } return ok; }