fix up extension context checking

This commit is contained in:
Grahame Grieve 2023-06-20 08:36:22 +10:00
parent be01ae2c21
commit 9cf8e0368c
2 changed files with 10 additions and 4 deletions

View File

@ -4151,7 +4151,6 @@ public class FHIRPathEngine {
String param = nl.get(0).primitiveValue(); String param = nl.get(0).primitiveValue();
List<Base> result = new ArrayList<Base>(); List<Base> result = new ArrayList<Base>();
if (focus.size() == 1) { if (focus.size() == 1) {
String cnt = focus.get(0).primitiveValue(); String cnt = focus.get(0).primitiveValue();
if ("hex".equals(param)) { if ("hex".equals(param)) {
@ -4164,7 +4163,6 @@ public class FHIRPathEngine {
result.add(new StringType(new String(enc.decode(cnt)))); result.add(new StringType(new String(enc.decode(cnt))));
} }
} }
return result; return result;
} }

View File

@ -2037,10 +2037,18 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
} else if (ctxt.getType() == ExtensionContextType.EXTENSION) { } else if (ctxt.getType() == ExtensionContextType.EXTENSION) {
contexts.append("x:" + ctxt.getExpression()); contexts.append("x:" + ctxt.getExpression());
String ext = stack.getElement().getNamedChildValue("url"); String ext = null;
if (stack.getElement().getName().startsWith("value")) {
NodeStack estack = stack.getParent();
if (estack != null && estack.getElement().fhirType().equals("Extension")) {
ext = estack.getElement().getNamedChildValue("url");
}
} else {
ext = stack.getElement().getNamedChildValue("url");
}
if (ctxt.getExpression().equals(ext)) { if (ctxt.getExpression().equals(ext)) {
ok = true; ok = true;
} else { } else if (ext != null) {
plist.add(ext); plist.add(ext);
} }
} else if (ctxt.getType() == ExtensionContextType.FHIRPATH) { } else if (ctxt.getType() == ExtensionContextType.FHIRPATH) {