Valid special cases on contained resources and Bundle entries
This commit is contained in:
parent
ac7a7c5a83
commit
194e2113ce
|
@ -5609,6 +5609,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
}
|
||||
|
||||
checkSpecials(hostContext, errors, element, stack, ok, pct, mode);
|
||||
|
||||
if (typeForResource.getProfile().size() == 1) {
|
||||
long t = System.nanoTime();
|
||||
StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, typeForResource.getProfile().get(0).asStringValue(), parentProfile);
|
||||
|
@ -6665,8 +6667,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
List<Element> performers = new ArrayList<>();
|
||||
element.getNamedChildren("performer", performers);
|
||||
ok = bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), performers.size() > 0, I18nConstants.ALL_OBSERVATIONS_SHOULD_HAVE_A_PERFORMER) && ok;
|
||||
ok = bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null, I18nConstants.ALL_OBSERVATIONS_SHOULD_HAVE_AN_EFFECTIVEDATETIME_OR_AN_EFFECTIVEPERIOD) && ok;
|
||||
|
||||
ok = bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(),
|
||||
element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null ||
|
||||
element.getNamedChild("effectiveTiming") != null || element.getNamedChild("effectiveInstant") != null,
|
||||
I18nConstants.ALL_OBSERVATIONS_SHOULD_HAVE_AN_EFFECTIVEDATETIME_OR_AN_EFFECTIVEPERIOD, element.getProperty().typeSummary()) && ok;
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,14 +115,14 @@ public class BundleValidator extends BaseValidator {
|
|||
String rtype = entry.getNamedChild(RESOURCE).fhirType();
|
||||
int rcount = counter.containsKey(rtype) ? counter.get(rtype)+1 : 0;
|
||||
counter.put(rtype, rcount);
|
||||
Element res = entry.getNamedChild(RESOURCE);
|
||||
NodeStack rstack = estack.push(res, -1, null, null);
|
||||
for (BundleValidationRule bvr : validator().getBundleValidationRules()) {
|
||||
if (meetsRule(bvr, rtype, rcount, count)) {
|
||||
StructureDefinition defn = context.fetchResource(StructureDefinition.class, bvr.getProfile());
|
||||
if (defn == null) {
|
||||
throw new Error(context.formatMessage(I18nConstants.BUNDLE_RULE_PROFILE_UNKNOWN, bvr.getRule(), bvr.getProfile()));
|
||||
} else {
|
||||
Element res = entry.getNamedChild(RESOURCE);
|
||||
NodeStack rstack = estack.push(res, -1, null, null);
|
||||
if (validator().isCrumbTrails()) {
|
||||
res.addMessage(signpost(errors, NO_RULE_DATE, IssueType.INFORMATIONAL, res.line(), res.col(), stack.getLiteralPath(), I18nConstants.VALIDATION_VAL_PROFILE_SIGNPOST_BUNDLE_PARAM, defn.getUrl()));
|
||||
}
|
||||
|
@ -131,6 +131,8 @@ public class BundleValidator extends BaseValidator {
|
|||
}
|
||||
}
|
||||
}
|
||||
// also, while we're here, check the specials, since this doesn't happen anywhere else
|
||||
((InstanceValidator) parent).checkSpecials(hostContext, errors, res, rstack, true, pct, mode);
|
||||
}
|
||||
|
||||
// todo: check specials
|
||||
|
|
Loading…
Reference in New Issue