Skip to content

Commit

Permalink
better error when extension URL not fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Grieve committed Aug 5, 2023
1 parent 5a59db6 commit 1dd1c4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}


Expand Down
2 changes: 2 additions & 0 deletions org.hl7.fhir.utilities/src/main/resources/Messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ public boolean validateStructureDefinition(List<ValidationMessage> errors, Eleme
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) {
Expand Down

0 comments on commit 1dd1c4a

Please sign in to comment.