Merge pull request #1339 from hapifhir/2023-07-gg-r5-invariants

fix issue checking invariant expressions in R5
This commit is contained in:
Grahame Grieve 2023-07-08 22:07:10 +10:00 committed by GitHub
commit 1384b143d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 16 deletions

View File

@ -485,6 +485,7 @@ public class StructureDefinitionValidator extends BaseValidator {
String source = invariant.getNamedChildValue("source");
if (warning(errors, "2023-06-19", IssueType.INFORMATIONAL, stack, !Utilities.noString(key), I18nConstants.ED_INVARIANT_NO_KEY)) {
if (hint(errors, "2023-06-19", IssueType.INFORMATIONAL, stack, !Utilities.noString(expression) || VersionUtilities.isR5Plus(context.getVersion()), I18nConstants.ED_INVARIANT_NO_EXPRESSION, key)) { // not for R5 - there's an invariant
if (!Utilities.noString(expression)) {
if (invariantMap.containsKey(key)) {
// it's legal - and common - for a list of elemnts to contain the same invariant more than once, but it's not valid if it's not always the same
ok = rule(errors, "2023-06-19", IssueType.INVALID, stack, expression.equals(invariantMap.get(key)) || "ele-1".equals(key), I18nConstants.ED_INVARIANT_EXPRESSION_CONFLICT, key, expression, invariantMap.get(key));
@ -504,6 +505,7 @@ public class StructureDefinitionValidator extends BaseValidator {
}
}
}
}
return ok;
}