Merge pull request #1520 from hapifhir/2023-12-gg-opdef-render
2023 12 gg opdef render
This commit is contained in:
commit
167584f406
|
@ -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("(");
|
||||
|
@ -157,5 +160,15 @@ 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<FHIRTypes> src) {
|
||||
if (src.hasExtension(EXT_OPDEF_ORIGINAL_TYPE)) {
|
||||
return src.getExtensionString(EXT_OPDEF_ORIGINAL_TYPE);
|
||||
} else {
|
||||
return src.asStringValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -20,7 +20,7 @@
|
|||
<properties>
|
||||
<guava_version>32.0.1-jre</guava_version>
|
||||
<hapi_fhir_version>6.4.1</hapi_fhir_version>
|
||||
<validator_test_case_version>1.4.19</validator_test_case_version>
|
||||
<validator_test_case_version>1.4.20-SNAPSHOT</validator_test_case_version>
|
||||
<jackson_version>2.16.0</jackson_version>
|
||||
<junit_jupiter_version>5.9.2</junit_jupiter_version>
|
||||
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
||||
|
|
Loading…
Reference in New Issue