Merge pull request #872 from hapifhir/gg-202207-bug-fixes

Gg 202207 bug fixes
This commit is contained in:
Grahame Grieve 2022-07-22 13:19:50 +10:00 committed by GitHub
commit 78c372961e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 94 additions and 47 deletions

View File

@ -4229,6 +4229,7 @@ public class ProfileUtilities extends TranslatingUtilities {
Row currRow = row; Row currRow = row;
List<ElementChoiceGroup> groups = readChoices(element, children); List<ElementChoiceGroup> groups = readChoices(element, children);
boolean isExtension = Utilities.existsInList(tail(element.getPath()), "extension", "modifierExtension"); boolean isExtension = Utilities.existsInList(tail(element.getPath()), "extension", "modifierExtension");
if (!element.prohibited()) {
for (ElementDefinition child : children) { for (ElementDefinition child : children) {
if (!child.hasSliceName()) { if (!child.hasSliceName()) {
currRow = row; currRow = row;
@ -4239,6 +4240,7 @@ public class ProfileUtilities extends TranslatingUtilities {
currRow = genElement(defPath, gen, childRow.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, isExtension, snapshot, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants, currRow, mustSupport, rc); currRow = genElement(defPath, gen, childRow.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, isExtension, snapshot, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants, currRow, mustSupport, rc);
} }
} }
}
// if (!snapshot && (extensions == null || !extensions)) // if (!snapshot && (extensions == null || !extensions))
// for (ElementDefinition child : children) // for (ElementDefinition child : children)
// if (child.getPath().endsWith(".extension") || child.getPath().endsWith(".modifierExtension")) // if (child.getPath().endsWith(".extension") || child.getPath().endsWith(".modifierExtension"))
@ -4349,7 +4351,7 @@ public class ProfileUtilities extends TranslatingUtilities {
res.add(addCell(row, gen.new Cell(null, null, "?gen-e1? "+element.getType().get(0).getProfile(), null, null))); res.add(addCell(row, gen.new Cell(null, null, "?gen-e1? "+element.getType().get(0).getProfile(), null, null)));
res.add(generateDescription(gen, row, element, (ElementDefinition) element.getUserData(DERIVATION_POINTER), used.used, profile == null ? "" : profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants, snapshot, mustSupport, allowSubRows, rc)); res.add(generateDescription(gen, row, element, (ElementDefinition) element.getUserData(DERIVATION_POINTER), used.used, profile == null ? "" : profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants, snapshot, mustSupport, allowSubRows, rc));
} else { } else {
String name = urltail(eurl); String name = element.hasSliceName() ? element.getSliceName() : urltail(eurl);
nameCell.getPieces().get(0).setText(name); nameCell.getPieces().get(0).setText(name);
// left.getPieces().get(0).setReference((String) extDefn.getExtensionStructure().getTag("filename")); // left.getPieces().get(0).setReference((String) extDefn.getExtensionStructure().getTag("filename"));
nameCell.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl()); nameCell.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl());

View File

@ -45,6 +45,7 @@ public class R5ExtensionsLoader {
JsonParser json = new JsonParser(); JsonParser json = new JsonParser();
for (PackageResourceInformation pri : pck.listIndexedResources(types)) { for (PackageResourceInformation pri : pck.listIndexedResources(types)) {
CanonicalResource r = (CanonicalResource) json.parse(pck.load(pri)); CanonicalResource r = (CanonicalResource) json.parse(pck.load(pri));
r.setUserData("path", Utilities.pathURL(pck.getWebLocation(), r.fhirType().toLowerCase()+ "-"+r.getId().toLowerCase()+".html"));
if (r instanceof CodeSystem) { if (r instanceof CodeSystem) {
codeSystems.put(r.getUrl(), (CodeSystem) r); codeSystems.put(r.getUrl(), (CodeSystem) r);
} else if (r instanceof ValueSet) { } else if (r instanceof ValueSet) {
@ -75,7 +76,7 @@ public class R5ExtensionsLoader {
for (ElementDefinition ed : sd.getSnapshot().getElement()) { for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.hasBinding() && ed.getBinding().hasValueSet()) { if (ed.hasBinding() && ed.getBinding().hasValueSet()) {
String vs = ed.getBinding().getValueSet(); String vs = ed.getBinding().getValueSet();
if (!context.hasResource(StructureDefinition.class, vs)) { if (!context.hasResource(ValueSet.class, vs)) {
loadValueSet(vs, context, valueSets, codeSystems, pd); loadValueSet(vs, context, valueSets, codeSystems, pd);
} }
} }

View File

@ -55,8 +55,8 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome; import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.utilities.ElementDecoration; import org.hl7.fhir.utilities.ElementDecoration;
import org.hl7.fhir.utilities.ElementDecoration.DecorationType; import org.hl7.fhir.utilities.ElementDecoration.DecorationType;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;
/** /**
@ -360,9 +360,12 @@ public class Element extends Base {
if (childMap == null) { if (childMap == null) {
childMap = new HashMap<>(); childMap = new HashMap<>();
for (Element child : children) { for (Element child : children) {
String n = child.getName(); String n;
if (n.endsWith("[x]")) { if (child.getProperty().getName().endsWith("[x]")) {
n = child.getProperty().getName();
n = n.substring(0, n.length()-3); n = n.substring(0, n.length()-3);
} else {
n = child.getName();
} }
List<Element> l = childMap.get(n); List<Element> l = childMap.get(n);
if (l == null) { if (l == null) {

View File

@ -54,8 +54,8 @@ import org.hl7.fhir.r5.formats.JsonCreator;
import org.hl7.fhir.r5.formats.JsonCreatorCanonical; import org.hl7.fhir.r5.formats.JsonCreatorCanonical;
import org.hl7.fhir.r5.formats.JsonCreatorGson; import org.hl7.fhir.r5.formats.JsonCreatorGson;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.i18n.I18nConstants; import org.hl7.fhir.utilities.i18n.I18nConstants;
@ -477,6 +477,7 @@ public class JsonParser extends ParserBase {
} }
private void compose(String path, Element e, Set<String> done, Element child) throws IOException { private void compose(String path, Element e, Set<String> done, Element child) throws IOException {
if (wantCompose(path, child)) {
boolean isList = child.hasElementProperty() ? child.getElementProperty().isList() : child.getProperty().isList(); boolean isList = child.hasElementProperty() ? child.getElementProperty().isList() : child.getProperty().isList();
if (!isList) {// for specials, ignore the cardinality of the stated type if (!isList) {// for specials, ignore the cardinality of the stated type
compose(path, child); compose(path, child);
@ -486,6 +487,8 @@ public class JsonParser extends ParserBase {
composeList(path, list); composeList(path, list);
} }
} }
}
private void composeList(String path, List<Element> list) throws IOException { private void composeList(String path, List<Element> list) throws IOException {
// there will be at least one element // there will be at least one element

View File

@ -40,7 +40,6 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.elementmodel.ParserBase.NamedElement;
import org.hl7.fhir.r5.formats.FormatUtilities; import org.hl7.fhir.r5.formats.FormatUtilities;
import org.hl7.fhir.r5.formats.IParser.OutputStyle; import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
@ -55,6 +54,18 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
public abstract class ParserBase { public abstract class ParserBase {
public enum IdRenderingPolicy {
All, None, RootOnly, NotRoot;
boolean forRoot() {
return this == All || this == RootOnly;
}
boolean forInner() {
return this == All || this == NotRoot;
}
}
public class NamedElement { public class NamedElement {
private String name; private String name;
private Element element; private Element element;
@ -92,6 +103,7 @@ public abstract class ParserBase {
protected List<ValidationMessage> errors; protected List<ValidationMessage> errors;
protected ILinkResolver linkResolver; protected ILinkResolver linkResolver;
protected boolean showDecorations; protected boolean showDecorations;
protected IdRenderingPolicy idPolicy = IdRenderingPolicy.All;
public ParserBase(IWorkerContext context) { public ParserBase(IWorkerContext context) {
super(); super();
@ -194,4 +206,23 @@ public abstract class ParserBase {
} }
public IdRenderingPolicy getIdPolicy() {
return idPolicy;
}
public void setIdPolicy(IdRenderingPolicy idPolicy) {
this.idPolicy = idPolicy;
}
protected boolean wantCompose(String path, Element e) {
if (!"id".equals(e.getName())) {
return true;
}
if (path.contains(".")) {
return idPolicy.forInner();
} else {
return idPolicy.forRoot();
}
}
} }

View File

@ -13,7 +13,6 @@ import java.util.Map.Entry;
import java.util.zip.DataFormatException; import java.util.zip.DataFormatException;
import java.util.zip.Inflater; import java.util.zip.Inflater;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.exceptions.FHIRFormatError;
@ -22,15 +21,14 @@ import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser; import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.json.JsonTrackingParser.LocationData; import org.hl7.fhir.utilities.json.JsonTrackingParser.LocationData;
import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive; import com.google.gson.JsonPrimitive;

View File

@ -34,13 +34,11 @@ package org.hl7.fhir.r5.elementmodel;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.context.SimpleWorkerContext; import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
import org.hl7.fhir.r5.elementmodel.ParserBase.NamedElement;
import org.hl7.fhir.r5.formats.IParser.OutputStyle; import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;

View File

@ -43,7 +43,6 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.elementmodel.Element.SpecialElement; import org.hl7.fhir.r5.elementmodel.Element.SpecialElement;
import org.hl7.fhir.r5.elementmodel.ParserBase.NamedElement;
import org.hl7.fhir.r5.formats.IParser.OutputStyle; import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
@ -395,6 +394,10 @@ public class TurtleParser extends ParserBase {
// (element.getProperty().getDefinition().getIsModifier()? "modifierExtension" : "extension") ; // (element.getProperty().getDefinition().getIsModifier()? "modifierExtension" : "extension") ;
String en = getFormalName(element); String en = getFormalName(element);
if (!wantCompose(parent == null ? "" : parent.getPath(), element)) {
return;
}
Complex t; Complex t;
if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY && parent != null && parent.getNamedChildValue("fullUrl") != null) { if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY && parent != null && parent.getNamedChildValue("fullUrl") != null) {
String url = "<"+parent.getNamedChildValue("fullUrl")+">"; String url = "<"+parent.getNamedChildValue("fullUrl")+">";

View File

@ -43,7 +43,6 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.elementmodel.ParserBase.NamedElement;
import org.hl7.fhir.r5.formats.IParser.OutputStyle; import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;

View File

@ -53,7 +53,6 @@ import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.conformance.ProfileUtilities; import org.hl7.fhir.r5.conformance.ProfileUtilities;
import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.elementmodel.Element.SpecialElement; import org.hl7.fhir.r5.elementmodel.Element.SpecialElement;
import org.hl7.fhir.r5.elementmodel.ParserBase.NamedElement;
import org.hl7.fhir.r5.formats.FormatUtilities; import org.hl7.fhir.r5.formats.FormatUtilities;
import org.hl7.fhir.r5.formats.IParser.OutputStyle; import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.model.DateTimeType; import org.hl7.fhir.r5.model.DateTimeType;
@ -702,7 +701,7 @@ public class XmlParser extends ParserBase {
} else { } else {
setXsiTypeIfIsTypeAttr(xml, element); setXsiTypeIfIsTypeAttr(xml, element);
for (Element child : element.getChildren()) { for (Element child : element.getChildren()) {
if (isAttr(child.getProperty())) { if (isAttr(child.getProperty()) && wantCompose(element.getPath(), child)) {
if (linkResolver != null) if (linkResolver != null)
xml.link(linkResolver.resolveType(child.getType())); xml.link(linkResolver.resolveType(child.getType()));
String av = child.getValue(); String av = child.getValue();
@ -720,12 +719,14 @@ public class XmlParser extends ParserBase {
xml.enter(element.getProperty().getXmlNamespace(),element.getType()); xml.enter(element.getProperty().getXmlNamespace(),element.getType());
} }
for (Element child : element.getChildren()) { for (Element child : element.getChildren()) {
if (wantCompose(element.getPath(), child)) {
if (isText(child.getProperty())) { if (isText(child.getProperty())) {
if (linkResolver != null) if (linkResolver != null)
xml.link(linkResolver.resolveProperty(element.getProperty())); xml.link(linkResolver.resolveProperty(element.getProperty()));
xml.text(child.getValue()); xml.text(child.getValue());
} else if (!isAttr(child.getProperty())) } else if (!isAttr(child.getProperty()))
composeElement(xml, child, child.getName(), false); composeElement(xml, child, child.getName(), false);
}
} }
if (!root && element.getSpecial() != null) if (!root && element.getSpecial() != null)
xml.exit(element.getProperty().getXmlNamespace(),element.getType()); xml.exit(element.getProperty().getXmlNamespace(),element.getType());

View File

@ -167,6 +167,9 @@ public class BundleRenderer extends ResourceRenderer {
} }
private ResourceWrapper resolveReference(List<BaseWrapper> entries, Base base) throws UnsupportedEncodingException, FHIRException, IOException { private ResourceWrapper resolveReference(List<BaseWrapper> entries, Base base) throws UnsupportedEncodingException, FHIRException, IOException {
if (base == null) {
return null;
}
Property prop = base.getChildByName("reference"); Property prop = base.getChildByName("reference");
if (prop.hasValues()) { if (prop.hasValues()) {
String ref = prop.getValues().get(0).primitiveValue(); String ref = prop.getValues().get(0).primitiveValue();
@ -195,7 +198,7 @@ public class BundleRenderer extends ResourceRenderer {
Resource subject = resolveReference(b, comp.getSubject()); Resource subject = resolveReference(b, comp.getSubject());
if (subject != null) { if (subject != null) {
XhtmlNode nx = (subject instanceof DomainResource) ? ((DomainResource) subject).getText().getDiv() : null; XhtmlNode nx = (subject instanceof DomainResource) ? ((DomainResource) subject).getText().getDiv() : null;
if (nx != null) { if (nx != null && !nx.isEmpty()) {
x.addChildren(nx); x.addChildren(nx);
} else { } else {
RendererFactory.factory(subject, context).render(x, subject); RendererFactory.factory(subject, context).render(x, subject);

View File

@ -159,9 +159,9 @@ public class ConceptMapRenderer extends TerminologyRenderer {
else { else {
if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) { if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE); String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
tr.td().ah(eqpath+"#"+code).tx(presentEquivalenceCode(code)); tr.td().ah(eqpath+"#"+code, code).tx(presentEquivalenceCode(code));
} else { } else {
tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode())); tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode(), ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode()));
} }
} }
td = tr.td(); td = tr.td();
@ -192,7 +192,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
if (hasRelationships) { if (hasRelationships) {
tr.td().b().tx("Relationship"); tr.td().b().tx("Relationship");
} }
tr.td().colspan(Integer.toString(1+targets.size())).b().tx("Destination Concept Details"); tr.td().colspan(Integer.toString(1+targets.size())).b().tx("Target Concept Details");
if (comment) { if (comment) {
tr.td().b().tx("Comment"); tr.td().b().tx("Comment");
} }
@ -299,9 +299,9 @@ public class ConceptMapRenderer extends TerminologyRenderer {
else { else {
if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) { if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE); String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
tr.td().ah(eqpath+"#"+code).tx(presentEquivalenceCode(code)); tr.td().ah(eqpath+"#"+code, code).tx(presentEquivalenceCode(code));
} else { } else {
tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode())); tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode(), ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode()));
} }
} }
} }

View File

@ -5094,6 +5094,9 @@ public class FHIRPathEngine {
int i2 = -1; int i2 = -1;
if (exp.parameterCount() == 2) { if (exp.parameterCount() == 2) {
List<Base> n2 = execute(context, focus, exp.getParameters().get(1), true); List<Base> n2 = execute(context, focus, exp.getParameters().get(1), true);
if (n2.isEmpty()|| !n2.get(0).isPrimitive() || !Utilities.isInteger(n2.get(0).primitiveValue())) {
return new ArrayList<Base>();
}
i2 = Integer.parseInt(n2.get(0).primitiveValue()); i2 = Integer.parseInt(n2.get(0).primitiveValue());
} }

View File

@ -8,6 +8,7 @@ import org.hl7.fhir.r5.context.IWorkerContext.ICanonicalResourceLocator;
import org.hl7.fhir.r5.elementmodel.Element; import org.hl7.fhir.r5.elementmodel.Element;
import org.hl7.fhir.r5.model.CanonicalResource; import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.ElementDefinition; import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.terminologies.TerminologyClient; import org.hl7.fhir.r5.terminologies.TerminologyClient;
@ -152,7 +153,7 @@ public class StandAloneValidatorFetcher implements IValidatorResourceFetcher, IV
} }
if (pi != null) { if (pi != null) {
context.loadFromPackage(pi, null); context.loadFromPackage(pi, null);
return pi.hasCanonical(url); return pi.hasCanonical(url) || context.fetchResource(Resource.class, url) != null;
} }
} }

View File

@ -2402,7 +2402,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
r = loadContainedResource(errors, path, hostContext.getRootResource(), url.substring(1), Resource.class); r = loadContainedResource(errors, path, hostContext.getRootResource(), url.substring(1), Resource.class);
} }
if (r == null) { if (r == null) {
fetcher.fetchCanonicalResource(this, url); r = fetcher.fetchCanonicalResource(this, url);
} }
if (r == null) { if (r == null) {
r = this.context.fetchResource(Resource.class, url); r = this.context.fetchResource(Resource.class, url);
@ -5660,7 +5660,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
msg = fpe.forLog(); msg = fpe.forLog();
} catch (Exception ex) { } catch (Exception ex) {
ok = false; ok = false;
msg = ex.getMessage(); msg = ex.getClass().getName()+": "+ex.getMessage();
ex.printStackTrace();
} }
if (!ok) { if (!ok) {
if (!Utilities.noString(msg)) { if (!Utilities.noString(msg)) {