Merge pull request #390 from hapifhir/gg-v525b

linux failed, but I couldn't see why. None of the tests failed.
This commit is contained in:
Grahame Grieve 2020-12-01 22:14:18 +11:00 committed by GitHub
commit b86585e100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 3 deletions

View File

@ -0,0 +1,5 @@
Validator:
* Add new validation to check these words in R3+: "Except for transactions and batches, each entry in a Bundle must have a fullUrl which is the identity of the resource in the entry"
Other code changes:
* Fix bug in package loader - allow loading version with later patch if old version is missing

View File

@ -27,6 +27,7 @@ public class I18nConstants {
public static final String BUNDLE_BUNDLE_ENTRY_NOFIRST = "Bundle_BUNDLE_Entry_NoFirst";
public static final String BUNDLE_BUNDLE_ENTRY_NOFIRSTRESOURCE = "Bundle_BUNDLE_Entry_NoFirstResource";
public static final String BUNDLE_BUNDLE_ENTRY_NOFULLURL = "Bundle_BUNDLE_Entry_NoFullUrl";
public static final String BUNDLE_BUNDLE_ENTRY_FULLURL_REQUIRED = "BUNDLE_BUNDLE_ENTRY_FULLURL_REQUIRED";
public static final String BUNDLE_BUNDLE_ENTRY_NOPROFILE = "Bundle_BUNDLE_Entry_NoProfile";
public static final String BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES = "BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES";
public static final String BUNDLE_BUNDLE_ENTRY_NOTFOUND = "Bundle_BUNDLE_Entry_NotFound";

View File

@ -221,6 +221,11 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
return retVal;
}
retVal = super.loadFromPackageServer(id, VersionUtilities.getMajMin(version)+".x");
if (retVal != null) {
return retVal;
}
// ok, well, we'll try the old way
return fetchTheOldWay(id, version);
}

View File

@ -7,6 +7,7 @@ Bundle_BUNDLE_Entry_MismatchIdUrl = The canonical URL ({0}) cannot match the ful
Bundle_BUNDLE_Entry_NoFirst = Documents or Messages must contain at least one entry
Bundle_BUNDLE_Entry_NoFirstResource = No resource on first entry
Bundle_BUNDLE_Entry_NoFullUrl = Bundle entry missing fullUrl
BUNDLE_BUNDLE_ENTRY_FULLURL_REQUIRED = Except for transactions and batches, each entry in a Bundle must have a fullUrl which is the identity of the resource in the entry
Bundle_BUNDLE_Entry_NoProfile = No profile found for contained resource of type ''{0}''
Bundle_BUNDLE_Entry_NotFound = Can''t find ''{0}'' in the bundle ({1})
Bundle_BUNDLE_Entry_Orphan = Entry {0} isn''t reachable by traversing from first Bundle entry

View File

@ -42,7 +42,7 @@ public class BundleValidator extends BaseValidator{
bundle.getNamedChildren(ENTRY, entries);
String type = bundle.getNamedChildValue(TYPE);
type = StringUtils.defaultString(type);
if (entries.size() == 0) {
rule(errors, IssueType.INVALID, stack.getLiteralPath(), !(type.equals(DOCUMENT) || type.equals(MESSAGE)), I18nConstants.BUNDLE_BUNDLE_ENTRY_NOFIRST);
} else {
@ -79,6 +79,8 @@ public class BundleValidator extends BaseValidator{
int count = 0;
Map<String, Integer> counter = new HashMap<>();
boolean fullUrlOptional = Utilities.existsInList(type, "transaction", "transaction-response", "batch", "batch-response");
for (Element entry : entries) {
NodeStack estack = stack.push(entry, count, null, null);
String fullUrl = entry.getNamedChildValue(FULL_URL);
@ -90,6 +92,9 @@ public class BundleValidator extends BaseValidator{
rule(errors, IssueType.INVALID, entry.line(), entry.col(), stack.addToLiteralPath(ENTRY, PATH_ARG), !url.equals(fullUrl) || serverBase == null || (url.equals(Utilities.pathURL(serverBase, entry.getNamedChild(RESOURCE).fhirType(), id))), I18nConstants.BUNDLE_BUNDLE_ENTRY_CANONICAL, url, fullUrl);
}
if (!VersionUtilities.isR2Ver(context.getVersion())) {
rule(errors, IssueType.INVALID, entry.line(), entry.col(), estack.getLiteralPath(), fullUrlOptional || fullUrl != null, I18nConstants.BUNDLE_BUNDLE_ENTRY_FULLURL_REQUIRED);
}
// check bundle profile requests
if (entry.hasChild(RESOURCE)) {
String rtype = entry.getNamedChild(RESOURCE).fhirType();

View File

@ -11,7 +11,7 @@
<!--
Note: Version of this project and the version of HAPI FHIR are not locked to
each other. It is fine to bump the point version of this POM without affecting
HAPI FHIR.
HAPI FHIR
-->
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.5-SNAPSHOT</version>
@ -19,7 +19,7 @@
<properties>
<hapi_fhir_version>5.1.0</hapi_fhir_version>
<validator_test_case_version>1.1.53-SNAPSHOT</validator_test_case_version>
<validator_test_case_version>1.1.53</validator_test_case_version>
<junit_jupiter_version>5.6.2</junit_jupiter_version>
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
<jacoco_version>0.8.5</jacoco_version>