From df9e11c40aaff6bf3b68b216956c916424a2054d Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sun, 2 Feb 2020 22:52:43 +1100 Subject: [PATCH] fix bug in validator on search params with no references + fix bug in cache manager on github urls --- .../hl7/fhir/utilities/cache/PackageCacheManager.java | 6 ++++++ .../org/hl7/fhir/r5/validation/InstanceValidator.java | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java index 23c472ab9..36bd34736 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java @@ -316,6 +316,9 @@ public class PackageCacheManager { save = checkIniHasMapping("hl7.fhir.core", "http://hl7.org/fhir", ini) || save; save = checkIniHasMapping("hl7.fhir.pubpack", "http://fhir.org/packages/hl7.fhir.pubpack", ini) || save; save = checkIniHasMapping("hl7.fhir.xver-extensions", "http://fhir.org/packages/hl7.fhir.xver-extensions", ini) || save; + save = checkIniHasMapping("fhir.base.template", "http://fhir.org/templates/fhir.base.template", ini) || save; + save = checkIniHasMapping("hl7.base.template", "http://fhir.org/templates/hl7.base.template", ini) || save; + save = checkIniHasMapping("hl7.fhir.template", "http://fhir.org/templates/hl7.fhir.template", ini) || save; save = checkIniHasMapping("hl7.fhir.r2.core", "http://hl7.org/fhir/DSTU2/hl7.fhir.r2.core.tgz", ini) || save; save = checkIniHasMapping("hl7.fhir.r2.examples", "http://hl7.org/fhir/DSTU2/hl7.fhir.r2.examples.tgz", ini) || save; @@ -382,6 +385,9 @@ public class PackageCacheManager { public void recordMap(String url, String id) throws IOException { if (url == null) return; + if (url.contains("github.com")) { + return; + } if (!(new File(Utilities.path(cacheFolder, "packages.ini")).exists())) throw new Error("File "+Utilities.path(cacheFolder, "packages.ini")+" not found #1"); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java index 7c4d8b41e..4940545de 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java @@ -3745,10 +3745,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat for (Element searchParam : resource.getChildrenByName("searchParam")) { String ref = searchParam.getChildValue("definition"); String type = searchParam.getChildValue("type"); - SearchParameter sp = context.fetchResource(SearchParameter.class, ref); - if (sp != null) { - rule(errors, IssueType.INVALID, searchParam.line(), searchParam.col(), stack.literalPath+".rest["+iRest+"].resource["+iResource+"].searchParam["+iSP+"]", - sp.getType().toCode().equals(type), "Type mismatch - SearchParameter '"+sp.getUrl()+"' type is "+sp.getType().toCode()+", but type here is "+type); + if (!Utilities.noString(ref)) { + SearchParameter sp = context.fetchResource(SearchParameter.class, ref); + if (sp != null) { + rule(errors, IssueType.INVALID, searchParam.line(), searchParam.col(), stack.literalPath+".rest["+iRest+"].resource["+iResource+"].searchParam["+iSP+"]", + sp.getType().toCode().equals(type), "Type mismatch - SearchParameter '"+sp.getUrl()+"' type is "+sp.getType().toCode()+", but type here is "+type); + } } iSP++; }