Valid special cases on contained resources and Bundle entries
This commit is contained in:
parent
ac7a7c5a83
commit
194e2113ce
|
@ -5608,6 +5608,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
checkSpecials(hostContext, errors, element, stack, ok, pct, mode);
|
||||
|
||||
if (typeForResource.getProfile().size() == 1) {
|
||||
long t = System.nanoTime();
|
||||
|
@ -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()));
|
||||
}
|
||||
|
@ -130,7 +130,9 @@ public class BundleValidator extends BaseValidator {
|
|||
ok = validator().startInner(hostContext, errors, res, res, defn, rstack, false, pct, mode) && ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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