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) {
|
private String commas(List<ElementDefinitionSlicingDiscriminatorComponent> list) {
|
||||||
CommaSeparatedStringBuilder c = new CommaSeparatedStringBuilder();
|
CommaSeparatedStringBuilder c = new CommaSeparatedStringBuilder();
|
||||||
for (ElementDefinitionSlicingDiscriminatorComponent id : list)
|
for (ElementDefinitionSlicingDiscriminatorComponent id : list)
|
||||||
c.append(id.getType().toCode()+":"+id.getPath());
|
c.append((id.hasType() ? id.getType().toCode() : "??")+":"+id.getPath());
|
||||||
return c.toString();
|
return c.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -687,8 +687,13 @@ public class ValueSetRenderer extends TerminologyRenderer {
|
||||||
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
||||||
hasExtensions = genInclude(ul, inc, "Include", langs, maps) || hasExtensions;
|
hasExtensions = genInclude(ul, inc, "Include", langs, maps) || hasExtensions;
|
||||||
}
|
}
|
||||||
for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
|
if (vs.getCompose().hasExclude()) {
|
||||||
hasExtensions = genInclude(ul, exc, "Exclude", langs, maps) || hasExtensions;
|
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()) {
|
for (File f : new File(cacheFolder).listFiles()) {
|
||||||
if (f.isDirectory()) {
|
if (f.isDirectory()) {
|
||||||
Utilities.clearDirectory(f.getAbsolutePath());
|
Utilities.clearDirectory(f.getAbsolutePath());
|
||||||
|
try {
|
||||||
FileUtils.deleteDirectory(f);
|
FileUtils.deleteDirectory(f);
|
||||||
|
} catch (Exception e1) {
|
||||||
|
try {
|
||||||
|
FileUtils.deleteDirectory(f);
|
||||||
|
} catch (Exception e2) {
|
||||||
|
// just give up
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!f.getName().equals("packages.ini"))
|
else if (!f.getName().equals("packages.ini"))
|
||||||
FileUtils.forceDelete(f);
|
FileUtils.forceDelete(f);
|
||||||
|
@ -652,8 +660,8 @@ public class PackageCacheManager {
|
||||||
InputStream stream = fetchFromUrlSpecific(Utilities.pathURL(ciList.get(id), "package.tgz"), false);
|
InputStream stream = fetchFromUrlSpecific(Utilities.pathURL(ciList.get(id), "package.tgz"), false);
|
||||||
return new InputStreamWithSrc(stream, Utilities.pathURL(ciList.get(id), "package.tgz"), "current");
|
return new InputStreamWithSrc(stream, Utilities.pathURL(ciList.get(id), "package.tgz"), "current");
|
||||||
} else if (id.startsWith("hl7.fhir.r5")) {
|
} else if (id.startsWith("hl7.fhir.r5")) {
|
||||||
InputStream stream = fetchFromUrlSpecific(Utilities.pathURL("http://hl7.org/fhir/2020Feb", id+".tgz"), false);
|
InputStream stream = fetchFromUrlSpecific(Utilities.pathURL("http://build.fhir.org", id+".tgz"), false);
|
||||||
return new InputStreamWithSrc(stream, Utilities.pathURL("http://hl7.org/fhir/2020Feb", id+".tgz"), "current");
|
return new InputStreamWithSrc(stream, Utilities.pathURL("http://build.fhir.org", id+".tgz"), "current");
|
||||||
} else {
|
} else {
|
||||||
throw new FHIRException("The package '"+id+"' has not entry on the current build server");
|
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_MultipleMatches = Multiple matches in bundle for reference {0}
|
||||||
Bundle_BUNDLE_Not_Local = URN reference is not locally contained within the bundle {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_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())]
|
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}
|
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
|
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;
|
boolean matchingResource = false;
|
||||||
for (CanonicalType target : containerType.getTargetProfile()) {
|
for (CanonicalType target : containerType.getTargetProfile()) {
|
||||||
StructureDefinition sd = resolveProfile(profile, target.asStringValue());
|
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)) {
|
if (("http://hl7.org/fhir/StructureDefinition/" + sd.getType()).equals(tu)) {
|
||||||
matchingResource = true;
|
matchingResource = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, matchingResource, I18nConstants.REFERENCE_REF_WRONGTARGET, reference.getType(), container.getType("Reference").getTargetProfile());
|
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) {
|
} else if (ei.definition.getContentReference() != null) {
|
||||||
typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getContentReference());
|
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()))) {
|
} 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()) {
|
if (ei.definition.getType().get(0).hasProfile()) {
|
||||||
CanonicalType pu = ei.definition.getType().get(0).getProfile().get(0);
|
CanonicalType pu = ei.definition.getType().get(0).getProfile().get(0);
|
||||||
|
@ -3654,7 +3657,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
String thisExtension = null;
|
String thisExtension = null;
|
||||||
boolean checkDisplay = true;
|
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);
|
ei.getElement().markValidation(profile, ei.definition);
|
||||||
boolean elementValidated = false;
|
boolean elementValidated = false;
|
||||||
|
@ -3910,18 +3913,20 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
ElementDefinition ed = childDefinitions.get(i);
|
ElementDefinition ed = childDefinitions.get(i);
|
||||||
boolean childUnsupportedSlicing = false;
|
boolean childUnsupportedSlicing = false;
|
||||||
boolean process = true;
|
boolean process = true;
|
||||||
if (ed.hasSlicing() && !ed.getSlicing().getOrdered())
|
if (ed.hasSlicing() && !ed.getSlicing().getOrdered()) {
|
||||||
slicingPath = ed.getPath();
|
slicingPath = ed.getPath();
|
||||||
else if (slicingPath != null && ed.getPath().equals(slicingPath))
|
} else if (slicingPath != null && ed.getPath().equals(slicingPath)) {
|
||||||
; // nothing
|
; // nothing
|
||||||
else if (slicingPath != null && !ed.getPath().startsWith(slicingPath))
|
} else if (slicingPath != null && !ed.getPath().startsWith(slicingPath)) {
|
||||||
slicingPath = null;
|
slicingPath = null;
|
||||||
|
}
|
||||||
// where are we with slicing
|
// where are we with slicing
|
||||||
if (ed.hasSlicing()) {
|
if (ed.hasSlicing()) {
|
||||||
if (slicer != null && slicer.getPath().equals(ed.getPath())) {
|
if (slicer != null && slicer.getPath().equals(ed.getPath())) {
|
||||||
String errorContext = "profile " + profile.getUrl();
|
String errorContext = "profile " + profile.getUrl();
|
||||||
if (!resource.getChildValue(ID).isEmpty())
|
if (!resource.getChildValue(ID).isEmpty()) {
|
||||||
errorContext += "; instance " + resource.getChildValue("id");
|
errorContext += "; instance " + resource.getChildValue("id");
|
||||||
|
}
|
||||||
throw new DefinitionException(context.formatMessage(I18nConstants.SLICE_ENCOUNTERED_MIDWAY_THROUGH_SET_PATH___ID___, slicer.getPath(), slicer.getId(), errorContext));
|
throw new DefinitionException(context.formatMessage(I18nConstants.SLICE_ENCOUNTERED_MIDWAY_THROUGH_SET_PATH___ID___, slicer.getPath(), slicer.getId(), errorContext));
|
||||||
}
|
}
|
||||||
slicer = ed;
|
slicer = ed;
|
||||||
|
@ -3941,9 +3946,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
int lastSlice = -1;
|
int lastSlice = -1;
|
||||||
for (ElementInfo ei : children) {
|
for (ElementInfo ei : children) {
|
||||||
String sliceInfo = "";
|
String sliceInfo = "";
|
||||||
if (slicer != null)
|
if (slicer != null) {
|
||||||
sliceInfo = " (slice: " + slicer.getPath() + ")";
|
sliceInfo = " (slice: " + slicer.getPath() + ")";
|
||||||
if (!unsupportedSlicing)
|
}
|
||||||
|
if (!unsupportedSlicing) {
|
||||||
if (ei.additionalSlice && ei.definition != null) {
|
if (ei.additionalSlice && ei.definition != null) {
|
||||||
if (ei.definition.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) ||
|
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" */) {
|
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 {
|
} else {
|
||||||
// Don't raise this if we're in an abstract profile, like Resource
|
// 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());
|
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
|
// TODO: Should get the order of elements correct when parsing elements that are XML attributes vs. elements
|
||||||
boolean isXmlAttr = false;
|
boolean isXmlAttr = false;
|
||||||
if (ei.definition != null) {
|
if (ei.definition != null) {
|
||||||
|
@ -3974,14 +3982,17 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
boolean ok = (ei.definition == null) || (ei.index >= last) || isXmlAttr;
|
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());
|
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());
|
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;
|
last = ei.index;
|
||||||
if (ei.slice != null)
|
}
|
||||||
|
if (ei.slice != null) {
|
||||||
lastSlice = ei.sliceindex;
|
lastSlice = ei.sliceindex;
|
||||||
else
|
} else {
|
||||||
lastSlice = -1;
|
lastSlice = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return problematicPaths;
|
return problematicPaths;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ title: FHIR Validator Release Notes
|
||||||
|
|
||||||
## Current (not released yet)
|
## 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 fatal NPE validating bundles when resource is missing
|
||||||
* fix tests for R5 changes
|
* fix tests for R5 changes
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue