Merge branch 'master' of https://github.com/hapifhir/org.hl7.fhir.core
This commit is contained in:
commit
0250f3ce34
|
@ -473,10 +473,12 @@ public class ValidationService {
|
|||
if (sessionId != null) {
|
||||
System.out.println("No such cached session exists for session id " + sessionId + ", re-instantiating validator.");
|
||||
}
|
||||
System.out.println("Building new validator engine from CliContext");
|
||||
ValidationEngine validator = buildValidationEngine(cliContext, definitions, tt);
|
||||
sessionId = sessionCache.cacheSession(validator);
|
||||
System.out.println("Cached new session. Cache size = " + sessionCache.getSessionIds().size());
|
||||
} else {
|
||||
System.out.println("Cached session exists for session id " + sessionId + ", returning stored validator session id.");
|
||||
System.out.println("Cached session exists for session id " + sessionId + ", returning stored validator session id. Cache size = " + sessionCache.getSessionIds().size());
|
||||
}
|
||||
return sessionId;
|
||||
}
|
||||
|
|
|
@ -1029,7 +1029,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
validateResource(new ValidationContext(appContext, element), errors, element, element, defn, resourceIdRule, stack.resetIds(), null, new ValidationMode(ValidationReason.Validation, ProfileSource.ConfigProfile), false, false);
|
||||
}
|
||||
}
|
||||
if (hintAboutNonMustSupport) {
|
||||
if (hintAboutNonMustSupport && !profiles.isEmpty()) {
|
||||
checkElementUsage(errors, element, stack);
|
||||
}
|
||||
codingObserver.finish(errors, stack);
|
||||
|
@ -1042,10 +1042,19 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
|
||||
private void checkElementUsage(List<ValidationMessage> errors, Element element, NodeStack stack) {
|
||||
if (element.getPath()==null
|
||||
|| (element.getName().equals("id") && !element.getPath().substring(0, element.getPath().length()-3).contains("."))
|
||||
|| (element.getName().equals("text") && !element.getPath().substring(0, element.getPath().length()-5).contains(".")))
|
||||
return;
|
||||
String hasFixed = element.getUserString("hasFixed");
|
||||
if (element.getPath().contains(".") && (hasFixed== null || !hasFixed.equals("Y"))) {
|
||||
String elementUsage = element.getUserString("elementSupported");
|
||||
hint(errors, NO_RULE_DATE, IssueType.INFORMATIONAL, element.line(), element.col(), stack.getLiteralPath(), elementUsage == null || elementUsage.equals("Y"), I18nConstants.MUSTSUPPORT_VAL_MUSTSUPPORT, element.getName(), element.getProperty().getStructure().getVersionedUrl());
|
||||
hint(errors, NO_RULE_DATE, IssueType.INFORMATIONAL, element.line(), element.col(), stack.getLiteralPath(), elementUsage != null && (elementUsage.equals("Y") || elementUsage.equals("NA")), I18nConstants.MUSTSUPPORT_VAL_MUSTSUPPORT, element.getName(), element.getProperty().getStructure().getVersionedUrl());
|
||||
if (elementUsage==null || !elementUsage.equals("Y"))
|
||||
return;
|
||||
}
|
||||
|
||||
if (element.hasChildren()) {
|
||||
if (element.hasChildren() && (hasFixed== null || !hasFixed.equals("Y"))) {
|
||||
String prevName = "";
|
||||
int elementCount = 0;
|
||||
for (Element ce : element.getChildren()) {
|
||||
|
@ -6745,13 +6754,16 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
profile.setUserData("usesMustSupport", usesMustSupport);
|
||||
}
|
||||
if (usesMustSupport.equals("Y")) {
|
||||
String elementSupported = ei.getElement().getUserString("elementSupported");
|
||||
if (elementSupported == null || ei.definition.getMustSupport())
|
||||
String fixedValue = ei.getElement().getUserString("hasFixed");
|
||||
if ((elementSupported == null || !elementSupported.equals("Y")) && ei.definition.getMustSupport()) {
|
||||
if (ei.definition.getMustSupport()) {
|
||||
ei.getElement().setUserData("elementSupported", "Y");
|
||||
}
|
||||
}
|
||||
} else if (elementSupported == null && !usesMustSupport.equals("Y"))
|
||||
ei.getElement().setUserData("elementSupported", "NA");
|
||||
if (fixedValue==null && (ei.definition.hasFixed() || ei.definition.hasPattern()))
|
||||
ei.getElement().setUserData("hasFixed", "Y");
|
||||
}
|
||||
|
||||
public boolean checkCardinalities(List<ValidationMessage> errors, StructureDefinition profile, Element element, NodeStack stack,
|
||||
|
|
|
@ -128,7 +128,9 @@ public class ProfileValidator extends BaseValidator {
|
|||
throw new Error("Diff Element is null - this is not an expected thing");
|
||||
ElementDefinition snapElement = snapshotElements.get(diffElement.getId());
|
||||
if (snapElement!=null) { // Happens with profiles in the main build - should be able to fix once snapshot generation is fixed - Lloyd
|
||||
warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, diffElement.getId(), !checkMustSupport || snapElement.hasMustSupport(), "Elements included in the differential should declare mustSupport");
|
||||
// We don't care about mustSupport for the root element, if the element is just declaring slicing, if there's a pattern or fixed value, or if the element is being prohibited.
|
||||
boolean noMustSupport = !checkMustSupport || !snapElement.getPath().contains(".") || snapElement.hasSlicing() || snapElement.hasPattern() || snapElement.hasFixed() || snapElement.getMax().equals("0") || snapElement.hasMustSupport();
|
||||
warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, diffElement.getId(), noMustSupport, "Elements included in the differential that aren't prohibited and don't have fixed values or patterns should declare mustSupport: " + snapElement.getPath());
|
||||
if (checkAggregation) {
|
||||
for (TypeRefComponent type : snapElement.getType()) {
|
||||
if ("http://hl7.org/fhir/Reference".equals(type.getWorkingCode()) || "http://hl7.org/fhir/canonical".equals(type.getWorkingCode())) {
|
||||
|
|
10
pom.xml
10
pom.xml
|
@ -741,6 +741,16 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<phase>deploy</phase>
|
||||
<goals><goal>jar</goal></goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
|
Loading…
Reference in New Issue