better error when extension URL not fixed

This commit is contained in:
Grahame Grieve 2023-08-05 20:58:49 +10:00
parent 5a59db667f
commit 1dd1c4ad90
3 changed files with 8 additions and 1 deletions

View File

@ -955,6 +955,7 @@ public class I18nConstants {
public static final String MSG_WITHDRAWN = "MSG_WITHDRAWN";
public static final String MSG_RETIRED = "MSG_RETIRED";
public static final String INACTIVE_CODE_WARNING = "INACTIVE_CODE_WARNING";
public static final String SD_EXTENSION_URL_MISSING = "SD_EXTENSION_URL_MISSING";
}

View File

@ -1008,7 +1008,9 @@ FHIRPATH_COLLECTION_STATUS_OPERATION_RIGHT = The right side is inherently a coll
FHIRPATH_OFTYPE_IMPOSSIBLE = The type specified in ofType is {1} which is not a possible candidate for the existing types ({0}) in the expression {2}. Check the paths and types to be sure this is what is intended
ED_SEARCH_EXPRESSION_ERROR = Error in search expression ''{0}'': {1}
SD_EXTENSION_URL_MISMATCH = The fixed value for the extension URL is {1} which doesn''t match the canonical URL {0}
SD_EXTENSION_URL_MISSING = The value of Extension.url is not fixed to the extension URL {0}
MSG_DEPRECATED = Reference to deprecated item {0}
MSG_WITHDRAWN = Reference to withdrawn item {0}
MSG_RETIRED = Reference to retired item {0}
INACTIVE_CODE_WARNING = The code ''{0}'' is valid but is not active
SD_ED_TYPE_PROFILE_WRONG_TYPE = The type {0} is not in the list of allowed types {1} in the profile {2}

View File

@ -169,7 +169,11 @@ public class StructureDefinitionValidator extends BaseValidator {
String baseD = src.getNamedChildValue("baseDefinition");
if ("http://hl7.org/fhir/StructureDefinition/Extension".equals(baseD) && url != null) {
String fixedUrl = getFixedValue(src);
ok = rule(errors, "2023-05-27", IssueType.INVALID, stack.getLiteralPath(), url.equals(fixedUrl), I18nConstants.SD_EXTENSION_URL_MISMATCH, url, fixedUrl) && ok;
if (rule(errors, "2023-08-05", IssueType.INVALID, stack.getLiteralPath(), fixedUrl != null, I18nConstants.SD_EXTENSION_URL_MISSING, url)) {
ok = rule(errors, "2023-08-05", IssueType.INVALID, stack.getLiteralPath(), url.equals(fixedUrl), I18nConstants.SD_EXTENSION_URL_MISMATCH, url, fixedUrl) && ok;
} else {
ok = false;
}
}
}
} catch (Exception e) {