From 9b94e6a1ec2f9756a306c61589583f2344f7b67d Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 28 Jun 2023 15:10:20 +1000 Subject: [PATCH] Fix test for correct type name in logical models (CDA) --- .../hl7/fhir/r5/conformance/profile/ProfileUtilities.java | 5 +++-- .../src/main/resources/Messages.properties | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java index 685ebab5c..de9cb3882 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java @@ -1086,6 +1086,7 @@ public class ProfileUtilities extends TranslatingUtilities { */ private void checkDifferential(List elements, String type, String url) { boolean first = true; + String t = urlTail(type); for (ElementDefinition ed : elements) { if (!ed.hasPath()) { throw new FHIRException(context.formatMessage(I18nConstants.NO_PATH_ON_ELEMENT_IN_DIFFERENTIAL_IN_, url)); @@ -1094,8 +1095,8 @@ public class ProfileUtilities extends TranslatingUtilities { if (p == null) { throw new FHIRException(context.formatMessage(I18nConstants.NO_PATH_VALUE_ON_ELEMENT_IN_DIFFERENTIAL_IN_, url)); } - if (!((first && type.equals(p)) || p.startsWith(type+"."))) { - throw new FHIRException(context.formatMessage(I18nConstants.ILLEGAL_PATH__IN_DIFFERENTIAL_IN__MUST_START_WITH_, p, url, type, (first ? " (or be '"+type+"')" : ""))); + if (!((first && t.equals(p)) || p.startsWith(t+"."))) { + throw new FHIRException(context.formatMessage(I18nConstants.ILLEGAL_PATH__IN_DIFFERENTIAL_IN__MUST_START_WITH_, p, url, t, (first ? " (or be '"+t+"')" : ""))); } if (p.contains(".")) { // Element names (the parts of a path delineated by the '.' character) SHALL NOT contain whitespace (i.e. Unicode characters marked as whitespace) diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index 76ecbc1d0..2be409752 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -876,9 +876,9 @@ SM_TARGET_TRANSFORM_EXPRESSION_ERROR = The FHIRPath expression passed as the eva SM_IMPORT_NOT_FOUND = No maps were found to match {0} - validation may be wrong SM_TARGET_TYPE_MULTIPLE_POSSIBLE = Multiple types are possible here ({0}) so further type checking is not possible SM_DEPENDENT_PARAM_MODE_MISMATCH = The parameter {0} refers to the variable {1} but it''s mode is {2} which is not the same as the mode required for the group {3} -SM_DEPENDENT_PARAM_NOT_FOUND = The parameter {0} mode {1} was not found +SM_DEPENDENT_PARAM_NOT_FOUND = The {1} parameter ''{0}'' was not found SM_DEPENDENT_PARAM_TYPE_MISMATCH = The parameter ''{0}'' refers to the variable ''{1}'' but it''s type is ''{2}'' which is not compatible with the type required for the group ''{3}'', which is ''{4}'' (from map ''{5}'') -SM_ORPHAN_GROUP = The group {0} is not called from within this mapping script, and does not have types on it''s inputs, so type verification is not possible +SM_ORPHAN_GROUP = The group {0} is not called successfully from within this mapping script, and does not have types on it''s inputs, so type verification is not possible SM_SOURCE_TYPE_NOT_FOUND = No source type was found, so the default group for this implied dependent rule could not be determined SM_TARGET_TYPE_NOT_FOUND = No target type was found, so the default group for this implied dependent rule could not be determined SM_MATCHING_RULEGROUP_NOT_FOUND = Unable to find a default rule for the type pair source={0} and target={1}