fix cross-version extensions URLs where possible

This commit is contained in:
Grahame Grieve 2023-08-19 09:04:19 +10:00
parent 6f0d54a8dc
commit b8d89d253e
1 changed files with 6 additions and 1 deletions

View File

@ -83,6 +83,7 @@ public class XVerExtensionManager {
String verSource = url.substring(20, 23);
String verTarget = VersionUtilities.getMajMin(context.getVersion());
String e = url.substring(54);
String r = e.contains(".") ? e.substring(0, e.indexOf(".")) : e;
JsonObject root = lists.get(verSource);
JsonObject path = root.getJsonObject(e);
if (path == null) {
@ -91,7 +92,11 @@ public class XVerExtensionManager {
StructureDefinition sd = new StructureDefinition();
sd.setUserData(XVER_EXT_MARKER, "true");
sd.setWebPath(PackageHacker.fixPackageUrl("https://hl7.org/fhir/versions.html#extensions"));
if (context.getResourceNamesAsSet().contains(r)) {
sd.setWebPath(Utilities.pathURL(context.getSpecUrl(), r.toLowerCase()+"-definitions.html#"+e));
} else {
sd.setWebPath(PackageHacker.fixPackageUrl("https://hl7.org/fhir/versions.html#extensions"));
}
sd.setUrl(url);
sd.setVersion(context.getVersion());
sd.setFhirVersion(FHIRVersion.fromCode(context.getVersion()));