diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java index 5a7c1d84a..8532156bc 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java @@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.model.CodeType; import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.Enumerations.FHIRTypes; import org.hl7.fhir.r5.model.Enumerations.VersionIndependentResourceTypesAll; import org.hl7.fhir.r5.model.Extension; import org.hl7.fhir.r5.model.OperationDefinition; @@ -21,6 +22,7 @@ import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.StandardsStatus; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.xhtml.XhtmlNode; public class OperationDefinitionRenderer extends TerminologyRenderer { @@ -122,9 +124,10 @@ public class OperationDefinitionRenderer extends TerminologyRenderer { } tr.td().addText(Integer.toString(p.getMin())+".."+p.getMax()); td = tr.td(); - StructureDefinition sd = p.getType() != null ? context.getWorker().fetchTypeDefinition(p.getType().toCode()) : null; + String actualType = translateTypeToVersion(p.getTypeElement()); + StructureDefinition sd = actualType != null ? context.getWorker().fetchTypeDefinition(actualType) : null; if (sd == null) - td.tx(p.hasType() ? p.getType().toCode() : ""); + td.tx(p.hasType() ? actualType : ""); else if (sd.getAbstract() && p.hasExtension(ToolingExtensions.EXT_ALLOWED_TYPE)) { boolean first = true; for (Extension ex : p.getExtensionsByUrl(ToolingExtensions.EXT_ALLOWED_TYPE)) { @@ -132,12 +135,12 @@ public class OperationDefinitionRenderer extends TerminologyRenderer { String s = ex.getValue().primitiveValue(); StructureDefinition sdt = context.getWorker().fetchTypeDefinition(s); if (sdt == null) - td.tx(p.hasType() ? p.getType().toCode() : ""); + td.tx(p.hasType() ? actualType : ""); else td.ah(sdt.getWebPath()).tx(s); } } else - td.ah(sd.getWebPath()).tx(p.hasType() ? p.getType().toCode() : ""); + td.ah(sd.getWebPath()).tx(actualType); if (p.hasSearchType()) { td.br(); td.tx("("); @@ -156,6 +159,16 @@ public class OperationDefinitionRenderer extends TerminologyRenderer { } } } + + public static final String EXT_OPDEF_ORIGINAL_TYPE = "http://hl7.org/fhir/4.0/StructureDefinition/extension-OperationDefinition.parameter.type"; + + private String translateTypeToVersion(Enumeration src) { + if (src.hasExtension(EXT_OPDEF_ORIGINAL_TYPE)) { + return src.getExtensionString(EXT_OPDEF_ORIGINAL_TYPE); + } else { + return src.asStringValue(); + } + } } 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 72f7b1a61..db91c4f2d 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 @@ -44,7 +44,7 @@ public class XVerExtensionManager { } public XVerExtensionStatus status(String url) throws FHIRException { - if (url.length() < 24) { + if (url.length() < 54) { return XVerExtensionStatus.Invalid; } String v = url.substring(20, 23); diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/CommonPackages.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/CommonPackages.java index 635a65100..ddddcdafc 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/CommonPackages.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/CommonPackages.java @@ -3,7 +3,7 @@ package org.hl7.fhir.utilities.npm; public class CommonPackages { public static final String ID_XVER = "hl7.fhir.xver-extensions"; - public static final String VER_XVER = "0.0.12"; + public static final String VER_XVER = "0.1.0"; public static final String ID_PUBPACK = "hl7.fhir.pubpack"; public static final String VER_PUBPACK = "0.1.7"; diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index bb1cb8393..f0b5416cc 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -162,6 +162,7 @@ import org.hl7.fhir.r5.utils.BuildExtensions; import org.hl7.fhir.r5.utils.ResourceUtilities; import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.r5.utils.XVerExtensionManager; +import org.hl7.fhir.r5.utils.XVerExtensionManager.XVerExtensionStatus; import org.hl7.fhir.r5.utils.sql.Validator; import org.hl7.fhir.r5.utils.validation.BundleValidationRule; import org.hl7.fhir.r5.utils.validation.IResourceValidator; @@ -2696,7 +2697,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat Utilities.existsInList(cc, "1.3.160", "1.3.88")), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_OID_VALID, cc) && ok; } - if (isCanonicalURLElement(e)) { + if (isCanonicalURLElement(e, node)) { // we get to here if this is a defining canonical URL (e.g. CodeSystem.url) // the URL must be an IRI if present ok = rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, Utilities.isAbsoluteUrl(url), @@ -3143,7 +3144,20 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat return Utilities.existsInList(t, "Resource", "CanonicalResource") || t.equals(r.fhirType()); } - private boolean isCanonicalURLElement(Element e) { + private boolean isCanonicalURLElement(Element e, NodeStack parent) { + if (parent != null && parent.getElement().getName().equals("extension")) { + String url = parent.getElement().getChildValue("url"); + if (xverManager.status(url) == XVerExtensionStatus.Valid && url.contains("-")) { + String path = url.substring(url.lastIndexOf("-")+1); + if (path.contains(".")) { + String type = path.substring(0, path.indexOf('.')); + String tail = path.substring(path.indexOf('.')+1); + if ("url".equals(tail) && VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains(type)) { + return true; + } + } + } + } if (e.getProperty() == null || e.getProperty().getDefinition() == null) { return false; } diff --git a/pom.xml b/pom.xml index 996fa1584..98af26297 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 32.0.1-jre 6.4.1 - 1.4.19 + 1.4.20-SNAPSHOT 2.16.0 5.9.2 1.8.2