fix bug in validator on search params with no references + fix bug in cache manager on github urls

This commit is contained in:
Grahame Grieve 2020-02-02 22:52:43 +11:00
parent b112b82951
commit df9e11c40a
2 changed files with 12 additions and 4 deletions

View File

@ -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");

View File

@ -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++;
}