Merge branch 'master' of https://github.com/hapifhir/org.hl7.fhir.core
This commit is contained in:
commit
c7444745de
|
@ -4252,7 +4252,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
private String commas(List<ElementDefinitionSlicingDiscriminatorComponent> list) {
|
||||
CommaSeparatedStringBuilder c = new CommaSeparatedStringBuilder();
|
||||
for (ElementDefinitionSlicingDiscriminatorComponent id : list)
|
||||
c.append(id.getType().toCode()+":"+id.getPath());
|
||||
c.append((id.hasType() ? id.getType().toCode() : "??")+":"+id.getPath());
|
||||
return c.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -687,8 +687,13 @@ public class ValueSetRenderer extends TerminologyRenderer {
|
|||
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
||||
hasExtensions = genInclude(ul, inc, "Include", langs, maps) || hasExtensions;
|
||||
}
|
||||
for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
|
||||
hasExtensions = genInclude(ul, exc, "Exclude", langs, maps) || hasExtensions;
|
||||
if (vs.getCompose().hasExclude()) {
|
||||
p = x.para();
|
||||
p.tx("This value set excludes codes based on the following rules:");
|
||||
ul = x.ul();
|
||||
for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
|
||||
hasExtensions = genInclude(ul, exc, "Exclude", langs, maps) || hasExtensions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,15 @@ public class PackageCacheManager {
|
|||
for (File f : new File(cacheFolder).listFiles()) {
|
||||
if (f.isDirectory()) {
|
||||
Utilities.clearDirectory(f.getAbsolutePath());
|
||||
try {
|
||||
FileUtils.deleteDirectory(f);
|
||||
} catch (Exception e1) {
|
||||
try {
|
||||
FileUtils.deleteDirectory(f);
|
||||
} catch (Exception e2) {
|
||||
// just give up
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!f.getName().equals("packages.ini"))
|
||||
FileUtils.forceDelete(f);
|
||||
|
@ -652,8 +660,8 @@ public class PackageCacheManager {
|
|||
InputStream stream = fetchFromUrlSpecific(Utilities.pathURL(ciList.get(id), "package.tgz"), false);
|
||||
return new InputStreamWithSrc(stream, Utilities.pathURL(ciList.get(id), "package.tgz"), "current");
|
||||
} else if (id.startsWith("hl7.fhir.r5")) {
|
||||
InputStream stream = fetchFromUrlSpecific(Utilities.pathURL("http://hl7.org/fhir/2020Feb", id+".tgz"), false);
|
||||
return new InputStreamWithSrc(stream, Utilities.pathURL("http://hl7.org/fhir/2020Feb", id+".tgz"), "current");
|
||||
InputStream stream = fetchFromUrlSpecific(Utilities.pathURL("http://build.fhir.org", id+".tgz"), false);
|
||||
return new InputStreamWithSrc(stream, Utilities.pathURL("http://build.fhir.org", id+".tgz"), "current");
|
||||
} else {
|
||||
throw new FHIRException("The package '"+id+"' has not entry on the current build server");
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ Bundle_BUNDLE_FullUrl_NeedVersion = Entries matching fullURL {0} should declare
|
|||
Bundle_BUNDLE_MultipleMatches = Multiple matches in bundle for reference {0}
|
||||
Bundle_BUNDLE_Not_Local = URN reference is not locally contained within the bundle {0}
|
||||
Bundle_MSG_Event_Count = Expected {0} but found {1} event elements
|
||||
Bundle_Document_Date_Missing = A document must have a date {0}
|
||||
Bundle_Document_Date_Missing = A document must have a date
|
||||
Bundle_Document_Date_Missing_html = [(type = 'document') implies (meta.lastUpdated.hasValue())]
|
||||
CapabalityStatement_CS_SP_WrongType = Type mismatch - SearchParameter "{0}" type is {1}, but type here is {2}
|
||||
CodeSystem_CS_VS_IncludeDetails = CodeSystem {0} has an ''all system'' value set of {1}, but the include has extra details
|
||||
|
|
|
@ -2185,10 +2185,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
boolean matchingResource = false;
|
||||
for (CanonicalType target : containerType.getTargetProfile()) {
|
||||
StructureDefinition sd = resolveProfile(profile, target.asStringValue());
|
||||
if (rule(errors, IssueType.NOTFOUND, element.line(), element.col(), path, sd != null, I18nConstants.REFERENCE_REF_CANTRESOLVEPROFILE, target.asStringValue())) {
|
||||
if (("http://hl7.org/fhir/StructureDefinition/" + sd.getType()).equals(tu)) {
|
||||
matchingResource = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, matchingResource, I18nConstants.REFERENCE_REF_WRONGTARGET, reference.getType(), container.getType("Reference").getTargetProfile());
|
||||
|
||||
|
@ -3627,6 +3629,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
} else if (ei.definition.getContentReference() != null) {
|
||||
typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getContentReference());
|
||||
|
||||
} else if (ei.definition.getType().size() == 1 && ("Element".equals(ei.definition.getType().get(0).getWorkingCode()) || "BackboneElement".equals(ei.definition.getType().get(0).getWorkingCode()))) {
|
||||
if (ei.definition.getType().get(0).hasProfile()) {
|
||||
CanonicalType pu = ei.definition.getType().get(0).getProfile().get(0);
|
||||
|
@ -3654,7 +3657,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
String thisExtension = null;
|
||||
boolean checkDisplay = true;
|
||||
|
||||
checkInvariants(hostContext, errors, profile, ei.definition, resource, ei.getElement(), localStack, true);
|
||||
checkInvariants(hostContext, errors, profile, typeDefn != null ? typeDefn : ei.definition, resource, ei.getElement(), localStack, true);
|
||||
|
||||
ei.getElement().markValidation(profile, ei.definition);
|
||||
boolean elementValidated = false;
|
||||
|
@ -3910,18 +3913,20 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
ElementDefinition ed = childDefinitions.get(i);
|
||||
boolean childUnsupportedSlicing = false;
|
||||
boolean process = true;
|
||||
if (ed.hasSlicing() && !ed.getSlicing().getOrdered())
|
||||
if (ed.hasSlicing() && !ed.getSlicing().getOrdered()) {
|
||||
slicingPath = ed.getPath();
|
||||
else if (slicingPath != null && ed.getPath().equals(slicingPath))
|
||||
} else if (slicingPath != null && ed.getPath().equals(slicingPath)) {
|
||||
; // nothing
|
||||
else if (slicingPath != null && !ed.getPath().startsWith(slicingPath))
|
||||
} else if (slicingPath != null && !ed.getPath().startsWith(slicingPath)) {
|
||||
slicingPath = null;
|
||||
}
|
||||
// where are we with slicing
|
||||
if (ed.hasSlicing()) {
|
||||
if (slicer != null && slicer.getPath().equals(ed.getPath())) {
|
||||
String errorContext = "profile " + profile.getUrl();
|
||||
if (!resource.getChildValue(ID).isEmpty())
|
||||
if (!resource.getChildValue(ID).isEmpty()) {
|
||||
errorContext += "; instance " + resource.getChildValue("id");
|
||||
}
|
||||
throw new DefinitionException(context.formatMessage(I18nConstants.SLICE_ENCOUNTERED_MIDWAY_THROUGH_SET_PATH___ID___, slicer.getPath(), slicer.getId(), errorContext));
|
||||
}
|
||||
slicer = ed;
|
||||
|
@ -3941,9 +3946,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
int lastSlice = -1;
|
||||
for (ElementInfo ei : children) {
|
||||
String sliceInfo = "";
|
||||
if (slicer != null)
|
||||
if (slicer != null) {
|
||||
sliceInfo = " (slice: " + slicer.getPath() + ")";
|
||||
if (!unsupportedSlicing)
|
||||
}
|
||||
if (!unsupportedSlicing) {
|
||||
if (ei.additionalSlice && ei.definition != null) {
|
||||
if (ei.definition.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) ||
|
||||
ei.definition.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPENATEND) && true /* TODO: replace "true" with condition to check that this element is at "end" */) {
|
||||
|
@ -3956,9 +3962,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
} else {
|
||||
// Don't raise this if we're in an abstract profile, like Resource
|
||||
if (!profile.getAbstract())
|
||||
if (!profile.getAbstract()) {
|
||||
rule(errors, IssueType.NOTSUPPORTED, ei.line(), ei.col(), ei.getPath(), (ei.definition != null), I18nConstants.VALIDATION_VAL_PROFILE_NOTALLOWED, profile.getUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Should get the order of elements correct when parsing elements that are XML attributes vs. elements
|
||||
boolean isXmlAttr = false;
|
||||
if (ei.definition != null) {
|
||||
|
@ -3974,14 +3982,17 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
boolean ok = (ei.definition == null) || (ei.index >= last) || isXmlAttr;
|
||||
rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.getPath(), ok, I18nConstants.VALIDATION_VAL_PROFILE_OUTOFORDER, profile.getUrl(), ei.getName());
|
||||
}
|
||||
if (ei.slice != null && ei.index == last && ei.slice.getSlicing().getOrdered())
|
||||
if (ei.slice != null && ei.index == last && ei.slice.getSlicing().getOrdered()) {
|
||||
rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.getPath(), (ei.definition == null) || (ei.sliceindex >= lastSlice) || isXmlAttr, I18nConstants.VALIDATION_VAL_PROFILE_SLICEORDER, profile.getUrl(), ei.getName());
|
||||
if (ei.definition == null || !isXmlAttr)
|
||||
}
|
||||
if (ei.definition == null || !isXmlAttr) {
|
||||
last = ei.index;
|
||||
if (ei.slice != null)
|
||||
}
|
||||
if (ei.slice != null) {
|
||||
lastSlice = ei.sliceindex;
|
||||
else
|
||||
} else {
|
||||
lastSlice = -1;
|
||||
}
|
||||
}
|
||||
return problematicPaths;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ title: FHIR Validator Release Notes
|
|||
|
||||
## Current (not released yet)
|
||||
|
||||
* Fix to check invariants on Elements with type redirections (e.g. ValueSet.compose.exclude)
|
||||
* fix fatal NPE validating bundles when resource is missing
|
||||
* fix tests for R5 changes
|
||||
|
||||
|
|
Loading…
Reference in New Issue