From c827a06698011f887d9c5b4947921c6059766e5f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 24 Jun 2021 21:45:01 +1000 Subject: [PATCH] Fix problem importing x-version extensions with multiple targets --- .../java/org/hl7/fhir/r5/utils/XVerExtensionManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java index fd682d128..bfdf2ac05 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java @@ -20,6 +20,7 @@ import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.json.JsonTrackingParser; +import org.hl7.fhir.utilities.npm.PackageHacker; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -84,7 +85,7 @@ public class XVerExtensionManager { StructureDefinition sd = new StructureDefinition(); sd.setUserData(XVER_EXT_MARKER, "true"); - sd.setUserData("path", "http://hl7.org/fhir/versions.html#extensions"); + sd.setUserData("path", PackageHacker.fixPackageUrl("https://hl7.org/fhir/versions.html#extensions")); sd.setUrl(url); sd.setVersion(context.getVersion()); sd.setFhirVersion(FHIRVersion.fromCode(context.getVersion())); @@ -138,7 +139,11 @@ public class XVerExtensionManager { for (String p : s.substring(0, s.length()-1).split("\\|")) { if ("Any".equals(p)) { tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource"); - } else { + } else if (p.contains(",")) { + for (String pp : p.split("\\,")) { + tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+pp); + } + } else { tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+p); } }