Fix issue with collection status of resolve() being wrong
This commit is contained in:
parent
8cc698af5d
commit
45b5631e62
|
@ -668,7 +668,7 @@ public class FHIRPathEngine {
|
|||
if (sd == null) {
|
||||
throw makeException(expr, I18nConstants.FHIRPATH_UNKNOWN_CONTEXT, t);
|
||||
}
|
||||
types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl());
|
||||
types.addType(sd.getUrl());
|
||||
} else {
|
||||
String ctxt = t.substring(0, t.indexOf('.'));
|
||||
StructureDefinition sd = cu.findType(ctxt);
|
||||
|
@ -680,11 +680,10 @@ public class FHIRPathEngine {
|
|||
throw makeException(expr, I18nConstants.FHIRPATH_UNKNOWN_CONTEXT_ELEMENT, t);
|
||||
}
|
||||
if (ed.fixedType != null) {
|
||||
types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType);
|
||||
types.addType(ed.fixedType);
|
||||
} else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) {
|
||||
types = new TypeDetails(CollectionStatus.SINGLETON, sd.getType()+"#"+t);
|
||||
types.addType(sd.getType()+"#"+t);
|
||||
} else {
|
||||
types = new TypeDetails(CollectionStatus.SINGLETON);
|
||||
for (TypeRefComponent tt : ed.getDefinition().getType()) {
|
||||
types.addType(tt.getCode());
|
||||
}
|
||||
|
@ -3545,7 +3544,7 @@ public class FHIRPathEngine {
|
|||
return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_DateTime);
|
||||
case Resolve : {
|
||||
checkContextReference(focus, "resolve", exp);
|
||||
return new TypeDetails(CollectionStatus.ORDERED, "DomainResource");
|
||||
return new TypeDetails(focus.getCollectionStatus(), "Resource");
|
||||
}
|
||||
case Extension : {
|
||||
checkParamTypes(exp, exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_String));
|
||||
|
|
|
@ -865,8 +865,12 @@ public class ValidationMessage implements Comparator<ValidationMessage>, Compara
|
|||
if (other.location != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!location.equals(other.location)) {
|
||||
return false;
|
||||
} else {
|
||||
String l1 = preprocessLocation(location);
|
||||
String l2 = preprocessLocation(other.location);
|
||||
if (!l1.equals(l2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (message == null) {
|
||||
if (other.message != null) {
|
||||
|
@ -890,6 +894,14 @@ public class ValidationMessage implements Comparator<ValidationMessage>, Compara
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String preprocessLocation(String loc) {
|
||||
// some locations are prefixes with a location but they're not different since the location is fixed where .match is called from
|
||||
if (loc.contains(": ")) {
|
||||
return loc.substring(loc.indexOf(": ")+2);
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5969,7 +5969,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (ed.hasSlicing()) {
|
||||
if (slicer != null && slicer.getPath().equals(ed.getPath())) {
|
||||
String errorContext = "profile " + profile.getVersionedUrl();
|
||||
if (!resource.getChildValue(ID).isEmpty()) {
|
||||
if (resource.hasChild(ID) && !resource.getChildValue(ID).isEmpty()) {
|
||||
errorContext += "; instance " + resource.getChildValue("id");
|
||||
}
|
||||
throw new DefinitionException(context.formatMessage(I18nConstants.SLICE_ENCOUNTERED_MIDWAY_THROUGH_SET_PATH___ID___, slicer.getPath(), slicer.getId(), errorContext));
|
||||
|
|
|
@ -103,8 +103,8 @@ public class StructureDefinitionValidator extends BaseValidator {
|
|||
for (ValidationMessage msg : msgs) {
|
||||
// we need to set the location for the context
|
||||
String loc = msg.getLocation();
|
||||
if (loc.contains("#")) {
|
||||
msg.setLocation(stack.getLiteralPath()+".differential.element.where(path = '"+loc.substring(loc.indexOf("#")+1)+"')");
|
||||
if (loc.startsWith("StructureDefinition.")) {
|
||||
msg.setLocation(stack.getLiteralPath()+loc.substring(loc.indexOf(".")));
|
||||
} else {
|
||||
msg.setLocation(stack.getLiteralPath());
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class SnapShotGenerationXTests {
|
|||
sort = "true".equals(test.getAttribute("sort"));
|
||||
fail = "true".equals(test.getAttribute("fail"));
|
||||
newSliceProcessing = !"false".equals(test.getAttribute("new-slice-processing"));
|
||||
debug = false; // "true".equals(test.getAttribute("debug"));
|
||||
debug = "true".equals(test.getAttribute("debug"));
|
||||
|
||||
id = test.getAttribute("id");
|
||||
include = test.getAttribute("include");
|
||||
|
@ -510,7 +510,7 @@ public class SnapShotGenerationXTests {
|
|||
pu.setAllowUnknownProfile(AllowUnknownProfile.ALL_TYPES);
|
||||
if (test.isSort()) {
|
||||
List<String> errors = new ArrayList<String>();
|
||||
int lastCount = output.getDifferential().getElement().size();
|
||||
// int lastCount = output.getDifferential().getElement().size();
|
||||
pu.sortDifferential(base, output, test.getSource().getName(), errors, false);
|
||||
if (errors.size() > 0)
|
||||
throw new FHIRException("Sort failed: " + errors.toString());
|
||||
|
|
Loading…
Reference in New Issue