diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e69de29bb..c90ed477f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -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 diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java index f56edd62c..fb42ca235 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java @@ -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"; diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java index 9dc317d2d..043161698 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java @@ -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); } diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index 247bb8dda..ddf5873e4 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -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 diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/BundleValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/BundleValidator.java index a5f41a4a8..7794339d1 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/BundleValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/BundleValidator.java @@ -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 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(); diff --git a/pom.xml b/pom.xml index eb145532a..89a301c67 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.hl7.fhir.core 5.2.5-SNAPSHOT @@ -19,7 +19,7 @@ 5.1.0 - 1.1.53-SNAPSHOT + 1.1.53 5.6.2 3.0.0-M4 0.8.5