fix extension context checking

This commit is contained in:
Grahame Grieve 2023-06-21 09:22:47 +10:00
parent 6effe6ebe9
commit 098b8d5520
3 changed files with 12 additions and 2 deletions

View File

@ -1998,4 +1998,12 @@ public class Utilities {
return Utilities.existsInList(file.getName(), ".DS_Store");
}
public static String rightTrim(String s) {
int i = s.length()-1;
while (i > 0 && Character.isWhitespace(s.charAt(i))) {
i--;
}
return i == 0 ? "" : s.substring(0, i+1);
}
}

View File

@ -407,7 +407,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
if (progress) {
log("");
logn(" Installing: ");
logn("Installing "+id+"#"+version);
}
if ((npm.name() != null && id != null && !id.equalsIgnoreCase(npm.name()))) {

View File

@ -493,6 +493,7 @@ public class StructureDefinitionValidator extends BaseValidator {
}
if (Utilities.noString(source) || (source.equals(profileUrl))) { // no need to revalidate FHIRPath from elsewhere
try {
// String upath = profileUrl+"#"+path;
fpe.check(invariant, rootPath, path, fpe.parse(expression));
} catch (Exception e) {
ok = rule(errors, "2023-06-19", IssueType.INVALID, stack, false, I18nConstants.ED_INVARIANT_EXPRESSION_ERROR, key, expression, e.getMessage()) && ok;
@ -506,7 +507,8 @@ public class StructureDefinitionValidator extends BaseValidator {
private boolean meaningWhenMissingAllowed(Element element) {
// allowed to use meaningWhenMissing on the root of an element to say what it means when the extension
// is not present.
return "Extension".equals(element.getPath()) || (element.getPath().endsWith(".extension"));
String path = element.getNamedChildValue("path");
return path != null && ("Extension".equals(path) || (path.endsWith(".extension")));
}
private boolean addCharacteristics(Set<String> set, String tc) {