diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java index 3bcf4f27d..5c3d4abe2 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java @@ -2524,14 +2524,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat String u = null; if (fullUrl != null && fullUrl.endsWith(type+"/"+id)) // fullUrl = complex - u = fullUrl.substring((type+"/"+id).length())+ref; + u = fullUrl.substring(0, fullUrl.length() - (type+"/"+id).length())+ref; +// u = fullUrl.substring((type+"/"+id).length())+ref; String[] parts = ref.split("\\/"); if (parts.length >= 2) { String t = parts[0]; String i = parts[1]; for (Element entry : entries) { String fu = entry.getNamedChildValue("fullUrl"); - if (u != null && fullUrl.equals(u)) + if (u != null && fu.equals(u)) return entry; if (u == null) { Element resource = entry.getNamedChild("resource"); diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/bundle-local-refs.xml b/org.hl7.fhir.validation/src/test/resources/validation-examples/bundle-local-refs.xml new file mode 100644 index 000000000..5e123eddf --- /dev/null +++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/bundle-local-refs.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </Composition> + </resource> + </entry> + <entry> + <fullUrl value="http://example.org/fhir/Patient/1"/> + <resource> + <Patient> + <id value="1"/> + <name> + <family value="SMITH"/> + <given value="JOE"/> + </name> + </Patient> + </resource> + </entry> +</Bundle> diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json b/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json index bdab13f10..59a4a5b34 100644 --- a/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json +++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json @@ -827,7 +827,11 @@ "source": "profile-slicing-profile-open.xml", "errorCount": 1 } - } + }, + "bundle-local-refs.xml" : { + "errorCount": 0, + "warningCount": 0 + } } } } \ No newline at end of file diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/synthea.json b/org.hl7.fhir.validation/src/test/resources/validation-examples/synthea.json index b7693ffde..988725669 100644 --- a/org.hl7.fhir.validation/src/test/resources/validation-examples/synthea.json +++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/synthea.json @@ -17,7 +17,7 @@ "value": "v6751" } ], - "status": "finished", + "status": "completed", "subject": { "reference": "Patient/f001", "display": "P. van de Heuvel"