diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/analytics/PackageVisitor.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/analytics/PackageVisitor.java
index 1608bfbe0..38ce67160 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/analytics/PackageVisitor.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/analytics/PackageVisitor.java
@@ -12,7 +12,7 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.SimpleHTTPClient;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.SimpleHTTPClient.HTTPResult;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
@@ -132,12 +132,12 @@ public class PackageVisitor {
list.add(i.getId());
}
JsonObject json = JsonTrackingParser.fetchJson("https://raw.githubusercontent.com/FHIR/ig-registry/master/fhir-ig-list.json");
- for (JsonObject ig : JSONUtil.objects(json, "guides")) {
- list.add(JSONUtil.str(ig, "npm-name"));
+ for (JsonObject ig : JsonUtilities.objects(json, "guides")) {
+ list.add(JsonUtilities.str(ig, "npm-name"));
}
json = JsonTrackingParser.fetchJson("https://raw.githubusercontent.com/FHIR/ig-registry/master/package-feeds.json");
- for (JsonObject feed : JSONUtil.objects(json, "feeds")) {
- processFeed(list, JSONUtil.str(feed, "url"));
+ for (JsonObject feed : JsonUtilities.objects(json, "feeds")) {
+ processFeed(list, JsonUtilities.str(feed, "url"));
}
return list;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/NpmPackageVersionConverter.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/NpmPackageVersionConverter.java
index de4ca9113..eb50e9479 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/NpmPackageVersionConverter.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/NpmPackageVersionConverter.java
@@ -13,7 +13,7 @@ import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_50;
import org.hl7.fhir.convertors.factory.*;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.VersionUtilities;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.NpmPackageIndexBuilder;
@@ -167,7 +167,7 @@ public class NpmPackageVersionConverter {
private byte[] convertPackage(byte[] cnt) throws IOException {
JsonObject json = JsonTrackingParser.parseJson(cnt);
currentVersion = json.getAsJsonArray("fhirVersions").get(0).getAsString();
- String name = JSONUtil.str(json, "name");
+ String name = JsonUtilities.str(json, "name");
json.remove("name");
json.addProperty("name", name + "." + vCode);
json.remove("fhirVersions");
diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/elementmodel/SHCParser.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/elementmodel/SHCParser.java
index a8d912a68..a58921e3a 100644
--- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/elementmodel/SHCParser.java
+++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/elementmodel/SHCParser.java
@@ -22,7 +22,7 @@ import org.hl7.fhir.r4b.formats.IParser.OutputStyle;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.json.JsonTrackingParser.LocationData;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
@@ -73,7 +73,7 @@ public class SHCParser extends ParserBase {
int i = 0;
for (JsonElement e : arr) {
if (!(e instanceof JsonPrimitive)) {
- logError(line(e), col(e), "$.verifiableCredential["+i+"]", IssueType.STRUCTURE, "Wrong Property verifiableCredential in JSON Payload. Expected : String but found "+JSONUtil.type(e), IssueSeverity.ERROR);
+ logError(line(e), col(e), "$.verifiableCredential["+i+"]", IssueType.STRUCTURE, "Wrong Property verifiableCredential in JSON Payload. Expected : String but found "+JsonUtilities.type(e), IssueSeverity.ERROR);
} else {
list.add(e.getAsString());
}
@@ -117,7 +117,7 @@ public class SHCParser extends ParserBase {
int i = 0;
for (JsonElement e : type) {
if (!(e instanceof JsonPrimitive)) {
- logError(line(e), col(e), path+".type["+i+"]", IssueType.STRUCTURE, "Wrong Property Type in JSON Payload. Expected : String but found "+JSONUtil.type(e), IssueSeverity.ERROR);
+ logError(line(e), col(e), path+".type["+i+"]", IssueType.STRUCTURE, "Wrong Property Type in JSON Payload. Expected : String but found "+JsonUtilities.type(e), IssueSeverity.ERROR);
} else {
types.add(e.getAsString());
}
@@ -171,7 +171,7 @@ public class SHCParser extends ParserBase {
private boolean checkProperty(JsonObject obj, String path, String name, boolean required, String type) {
JsonElement e = obj.get(name);
if (e != null) {
- String t = JSONUtil.type(e);
+ String t = JsonUtilities.type(e);
if (!type.equals(t)) {
logError(line(e), col(e), path+"."+name, IssueType.STRUCTURE, "Wrong Property Type in JSON Payload. Expected : "+type+" but found "+t, IssueSeverity.ERROR);
} else {
@@ -275,7 +275,7 @@ public class SHCParser extends ParserBase {
}
JWT res = new JWT();
res.header = JsonTrackingParser.parseJson(headerJson);
- if ("DEF".equals(JSONUtil.str(res.header, "zip"))) {
+ if ("DEF".equals(JsonUtilities.str(res.header, "zip"))) {
payloadJson = inflate(payloadJson);
}
res.payload = JsonTrackingParser.parse(TextFile.bytesToString(payloadJson), res.map, true);
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java
index 3f5d3e0a1..a1d4f6230 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java
@@ -3744,7 +3744,7 @@ public class ProfileUtilities extends TranslatingUtilities {
}
} else if (Utilities.isAbsoluteUrl(u)) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, u);
- if (sd != null) {
+ if (sd != null && pkp != null) {
String disp = sd.hasTitle() ? sd.getTitle() : sd.getName();
String ref = pkp.getLinkForProfile(null, sd.getUrl());
if (ref != null && ref.contains("|"))
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java
index f7d2ef3b7..0b0d8c5e6 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java
@@ -1102,11 +1102,13 @@ public class Element extends Base {
public int countDescendents() {
if (descendentCount > 0) {
return descendentCount;
- } else {
+ } else if (children != null) {
descendentCount = children.size();
for (Element e : children) {
descendentCount = descendentCount + e.countDescendents();
}
+ } else {
+ descendentCount = 0;
}
return descendentCount;
}
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java
index a7c89f4b0..e52ce7ea8 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java
@@ -22,7 +22,7 @@ import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.json.JsonTrackingParser.LocationData;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
@@ -73,7 +73,7 @@ public class SHCParser extends ParserBase {
int i = 0;
for (JsonElement e : arr) {
if (!(e instanceof JsonPrimitive)) {
- logError(line(e), col(e), "$.verifiableCredential["+i+"]", IssueType.STRUCTURE, "Wrong Property verifiableCredential in JSON Payload. Expected : String but found "+JSONUtil.type(e), IssueSeverity.ERROR);
+ logError(line(e), col(e), "$.verifiableCredential["+i+"]", IssueType.STRUCTURE, "Wrong Property verifiableCredential in JSON Payload. Expected : String but found "+JsonUtilities.type(e), IssueSeverity.ERROR);
} else {
list.add(e.getAsString());
}
@@ -117,7 +117,7 @@ public class SHCParser extends ParserBase {
int i = 0;
for (JsonElement e : type) {
if (!(e instanceof JsonPrimitive)) {
- logError(line(e), col(e), path+".type["+i+"]", IssueType.STRUCTURE, "Wrong Property Type in JSON Payload. Expected : String but found "+JSONUtil.type(e), IssueSeverity.ERROR);
+ logError(line(e), col(e), path+".type["+i+"]", IssueType.STRUCTURE, "Wrong Property Type in JSON Payload. Expected : String but found "+JsonUtilities.type(e), IssueSeverity.ERROR);
} else {
types.add(e.getAsString());
}
@@ -171,7 +171,7 @@ public class SHCParser extends ParserBase {
private boolean checkProperty(JsonObject obj, String path, String name, boolean required, String type) {
JsonElement e = obj.get(name);
if (e != null) {
- String t = JSONUtil.type(e);
+ String t = JsonUtilities.type(e);
if (!type.equals(t)) {
logError(line(e), col(e), path+"."+name, IssueType.STRUCTURE, "Wrong Property Type in JSON Payload. Expected : "+type+" but found "+t, IssueSeverity.ERROR);
} else {
@@ -275,7 +275,7 @@ public class SHCParser extends ParserBase {
}
JWT res = new JWT();
res.header = JsonTrackingParser.parseJson(headerJson);
- if ("DEF".equals(JSONUtil.str(res.header, "zip"))) {
+ if ("DEF".equals(JsonUtilities.str(res.header, "zip"))) {
payloadJson = inflate(payloadJson);
}
res.payload = JsonTrackingParser.parse(TextFile.bytesToString(payloadJson), res.map, true);
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java
index e56a8f903..0117d2116 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java
@@ -262,6 +262,7 @@ public class FHIRPathEngine {
private ProfileUtilities profileUtilities;
private String location; // for error messages
private boolean allowPolymorphicNames;
+ private boolean doImplicitStringConversion;
// if the fhir path expressions are allowed to use constants beyond those defined in the specification
// the application can implement them by providing a constant resolver
@@ -447,6 +448,14 @@ public class FHIRPathEngine {
}
+ public boolean isDoImplicitStringConversion() {
+ return doImplicitStringConversion;
+ }
+
+ public void setDoImplicitStringConversion(boolean doImplicitStringConversion) {
+ this.doImplicitStringConversion = doImplicitStringConversion;
+ }
+
// --- public API -------------------------------------------------------
/**
* Parse a path for later use using execute
@@ -4211,14 +4220,16 @@ public class FHIRPathEngine {
List result = new ArrayList();
if (focus.size() == 1) {
- String f = convertToString(focus.get(0));
- if (Utilities.noString(f)) {
- result.add(new StringType(""));
- } else {
- String t = convertToString(execute(context, focus, expr.getParameters().get(0), true));
- String r = convertToString(execute(context, focus, expr.getParameters().get(1), true));
- String n = f.replace(t, r);
- result.add(new StringType(n));
+ if (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion) {
+ String f = convertToString(focus.get(0));
+ if (Utilities.noString(f)) {
+ result.add(new StringType(""));
+ } else {
+ String t = convertToString(execute(context, focus, expr.getParameters().get(0), true));
+ String r = convertToString(execute(context, focus, expr.getParameters().get(1), true));
+ String n = f.replace(t, r);
+ result.add(new StringType(n));
+ }
}
} else {
throw makeException(expr, I18nConstants.FHIRPATH_NO_COLLECTION, "replace", focus.size());
@@ -4233,7 +4244,9 @@ public class FHIRPathEngine {
String repl = convertToString(execute(context, focus, exp.getParameters().get(1), true));
if (focus.size() == 1 && !Utilities.noString(regex)) {
- result.add(new StringType(convertToString(focus.get(0)).replaceAll(regex, repl)).noExtensions());
+ if (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion) {
+ result.add(new StringType(convertToString(focus.get(0)).replaceAll(regex, repl)).noExtensions());
+ }
} else {
result.add(new StringType(convertToString(focus.get(0))).noExtensions());
}
@@ -4249,7 +4262,7 @@ public class FHIRPathEngine {
result.add(new BooleanType(false).noExtensions());
} else if (Utilities.noString(sw)) {
result.add(new BooleanType(true).noExtensions());
- } else {
+ } else if (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion) {
if (focus.size() == 1 && !Utilities.noString(sw)) {
result.add(new BooleanType(convertToString(focus.get(0)).endsWith(sw)).noExtensions());
} else {
@@ -4919,14 +4932,16 @@ public class FHIRPathEngine {
String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
if (focus.size() == 1 && !Utilities.noString(sw)) {
- String st = convertToString(focus.get(0));
- if (Utilities.noString(st)) {
- result.add(new BooleanType(false).noExtensions());
- } else {
- Pattern p = Pattern.compile("(?s)" + sw);
- Matcher m = p.matcher(st);
- boolean ok = m.find();
- result.add(new BooleanType(ok).noExtensions());
+ if (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion) {
+ String st = convertToString(focus.get(0));
+ if (Utilities.noString(st)) {
+ result.add(new BooleanType(false).noExtensions());
+ } else {
+ Pattern p = Pattern.compile("(?s)" + sw);
+ Matcher m = p.matcher(st);
+ boolean ok = m.find();
+ result.add(new BooleanType(ok).noExtensions());
+ }
}
} else {
result.add(new BooleanType(false).noExtensions());
@@ -4939,14 +4954,16 @@ public class FHIRPathEngine {
String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
if (focus.size() == 1 && !Utilities.noString(sw)) {
- String st = convertToString(focus.get(0));
- if (Utilities.noString(st)) {
- result.add(new BooleanType(false).noExtensions());
- } else {
- Pattern p = Pattern.compile("(?s)" + sw);
- Matcher m = p.matcher(st);
- boolean ok = m.matches();
- result.add(new BooleanType(ok).noExtensions());
+ if (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion) {
+ String st = convertToString(focus.get(0));
+ if (Utilities.noString(st)) {
+ result.add(new BooleanType(false).noExtensions());
+ } else {
+ Pattern p = Pattern.compile("(?s)" + sw);
+ Matcher m = p.matcher(st);
+ boolean ok = m.matches();
+ result.add(new BooleanType(ok).noExtensions());
+ }
}
} else {
result.add(new BooleanType(false).noExtensions());
@@ -4962,7 +4979,7 @@ public class FHIRPathEngine {
result.add(new BooleanType(false).noExtensions());
} else if (Utilities.noString(sw)) {
result.add(new BooleanType(true).noExtensions());
- } else {
+ } else if (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion) {
String st = convertToString(focus.get(0));
if (Utilities.noString(st)) {
result.add(new BooleanType(false).noExtensions());
@@ -4981,7 +4998,7 @@ public class FHIRPathEngine {
private List funcLength(ExecutionContext context, List focus, ExpressionNode exp) {
List result = new ArrayList();
- if (focus.size() == 1) {
+ if (focus.size() == 1 && (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion)) {
String s = convertToString(focus.get(0));
result.add(new IntegerType(s.length()).noExtensions());
}
@@ -5007,7 +5024,7 @@ public class FHIRPathEngine {
result.add(new BooleanType(false).noExtensions());
} else if (Utilities.noString(sw)) {
result.add(new BooleanType(true).noExtensions());
- } else {
+ } else if (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion) {
String s = convertToString(focus.get(0));
if (s == null) {
result.add(new BooleanType(false).noExtensions());
@@ -5020,7 +5037,7 @@ public class FHIRPathEngine {
private List funcLower(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
List result = new ArrayList();
- if (focus.size() == 1) {
+ if (focus.size() == 1 && (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion)) {
String s = convertToString(focus.get(0));
if (!Utilities.noString(s)) {
result.add(new StringType(s.toLowerCase()).noExtensions());
@@ -5031,7 +5048,7 @@ public class FHIRPathEngine {
private List funcUpper(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
List result = new ArrayList();
- if (focus.size() == 1) {
+ if (focus.size() == 1 && (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion)) {
String s = convertToString(focus.get(0));
if (!Utilities.noString(s)) {
result.add(new StringType(s.toUpperCase()).noExtensions());
@@ -5042,7 +5059,7 @@ public class FHIRPathEngine {
private List funcToChars(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
List result = new ArrayList();
- if (focus.size() == 1) {
+ if (focus.size() == 1 && (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion)) {
String s = convertToString(focus.get(0));
for (char c : s.toCharArray()) {
result.add(new StringType(String.valueOf(c)).noExtensions());
@@ -5059,7 +5076,7 @@ public class FHIRPathEngine {
result.add(new IntegerType(0).noExtensions());
} else if (Utilities.noString(sw)) {
result.add(new IntegerType(0).noExtensions());
- } else {
+ } else if (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion) {
String s = convertToString(focus.get(0));
if (s == null) {
result.add(new IntegerType(0).noExtensions());
@@ -5080,7 +5097,7 @@ public class FHIRPathEngine {
i2 = Integer.parseInt(n2.get(0).primitiveValue());
}
- if (focus.size() == 1) {
+ if (focus.size() == 1 && (focus.get(0).hasType(FHIR_TYPES_STRING) || doImplicitStringConversion)) {
String sw = convertToString(focus.get(0));
String s;
if (i1 < 0 || i1 >= sw.length()) {
diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/SimpleHTTPClient.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/SimpleHTTPClient.java
index bca68df6a..ee62af742 100644
--- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/SimpleHTTPClient.java
+++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/SimpleHTTPClient.java
@@ -71,7 +71,7 @@ public class SimpleHTTPClient {
public void checkThrowException() throws IOException {
if (code >= 300) {
String filename = Utilities.path("[tmp]", "fhir-http-"+(++counter)+".log");
- if (content.length == 0) {
+ if (content == null || content.length == 0) {
throw new IOException("Invalid HTTP response "+code+" from "+source+" ("+message+") (no content)");
} else {
TextFile.bytesToFile(content, filename);
diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/Utilities.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/Utilities.java
index 96aa35479..5f29390ad 100644
--- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/Utilities.java
+++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/Utilities.java
@@ -1333,6 +1333,30 @@ public class Utilities {
return false;
}
+ public static boolean endsWithInList(String s, String... list) {
+ if (s == null) {
+ return false;
+ }
+ for (String l : list) {
+ if (s.endsWith(l)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean endsWithInList(String s, Collection list) {
+ if (s == null) {
+ return false;
+ }
+ for (String l : list) {
+ if (s.endsWith(l)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static final int ONE_MB = 1024;
public static final String GB = "Gb";
public static final String MB = "Mb";
diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JSONUtil.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonUtilities.java
similarity index 93%
rename from org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JSONUtil.java
rename to org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonUtilities.java
index 99e7fc77b..955870333 100644
--- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JSONUtil.java
+++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonUtilities.java
@@ -45,7 +45,7 @@ import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
-public class JSONUtil {
+public class JsonUtilities {
public static JsonObject parse(String json) throws IOException {
return JsonTrackingParser.parseJson(json);
@@ -155,4 +155,15 @@ public class JSONUtil {
return "String";
}
+ public static List strings(JsonArray arr) {
+ List res = new ArrayList();
+ for (int i = 0; i < arr.size(); i++) {
+ JsonElement n = arr.get(i);
+ if (n.isJsonPrimitive()) {
+ res.add(n.getAsString());
+ }
+ }
+ return res;
+ }
+
}
\ No newline at end of file
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 b14fc3019..04f29c1b3 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
@@ -42,7 +42,7 @@ import org.hl7.fhir.utilities.IniFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.NpmPackage.NpmPackageFolder;
import org.slf4j.Logger;
@@ -414,14 +414,14 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
log(" done.");
}
pck = loadPackageInfo(packRoot);
- if (!id.equals(JSONUtil.str(npm.getNpm(), "name")) || !v.equals(JSONUtil.str(npm.getNpm(), "version"))) {
- if (!id.equals(JSONUtil.str(npm.getNpm(), "name"))) {
- npm.getNpm().addProperty("original-name", JSONUtil.str(npm.getNpm(), "name"));
+ if (!id.equals(JsonUtilities.str(npm.getNpm(), "name")) || !v.equals(JsonUtilities.str(npm.getNpm(), "version"))) {
+ if (!id.equals(JsonUtilities.str(npm.getNpm(), "name"))) {
+ npm.getNpm().addProperty("original-name", JsonUtilities.str(npm.getNpm(), "name"));
npm.getNpm().remove("name");
npm.getNpm().addProperty("name", id);
}
- if (!v.equals(JSONUtil.str(npm.getNpm(), "version"))) {
- npm.getNpm().addProperty("original-version", JSONUtil.str(npm.getNpm(), "version"));
+ if (!v.equals(JsonUtilities.str(npm.getNpm(), "version"))) {
+ npm.getNpm().addProperty("original-version", JsonUtilities.str(npm.getNpm(), "version"));
npm.getNpm().remove("version");
npm.getNpm().addProperty("version", v);
}
@@ -566,8 +566,8 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
checkBuildLoaded();
for (JsonElement n : buildInfo) {
JsonObject o = (JsonObject) n;
- if (packageId.equals(JSONUtil.str(o, "package-id"))) {
- return JSONUtil.str(o, "url");
+ if (packageId.equals(JsonUtilities.str(o, "package-id"))) {
+ return JsonUtilities.str(o, "url");
}
}
return null;
@@ -577,8 +577,8 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
checkBuildLoaded();
for (JsonElement n : buildInfo) {
JsonObject o = (JsonObject) n;
- if (!specList.containsKey(JSONUtil.str(o, "package-id"))) {
- specList.put(JSONUtil.str(o, "package-id"), JSONUtil.str(o, "url"));
+ if (!specList.containsKey(JsonUtilities.str(o, "package-id"))) {
+ specList.put(JsonUtilities.str(o, "package-id"), JsonUtilities.str(o, "url"));
}
}
}
@@ -604,8 +604,8 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
for (String pf : listPackages()) {
if (new File(Utilities.path(cacheFolder, pf, "package", "package.json")).exists()) {
JsonObject npm = JsonTrackingParser.parseJsonFile(Utilities.path(cacheFolder, pf, "package", "package.json"));
- if (canonicalUrl.equals(JSONUtil.str(npm, "canonical"))) {
- return JSONUtil.str(npm, "name");
+ if (canonicalUrl.equals(JsonUtilities.str(npm, "canonical"))) {
+ return JsonUtilities.str(npm, "name");
}
}
}
@@ -624,14 +624,14 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
if (buildInfo != null) {
for (JsonElement n : buildInfo) {
JsonObject o = (JsonObject) n;
- if (canonical.equals(JSONUtil.str(o, "url"))) {
- return JSONUtil.str(o, "package-id");
+ if (canonical.equals(JsonUtilities.str(o, "url"))) {
+ return JsonUtilities.str(o, "package-id");
}
}
for (JsonElement n : buildInfo) {
JsonObject o = (JsonObject) n;
- if (JSONUtil.str(o, "url").startsWith(canonical + "/ImplementationGuide/")) {
- return JSONUtil.str(o, "package-id");
+ if (JsonUtilities.str(o, "url").startsWith(canonical + "/ImplementationGuide/")) {
+ return JsonUtilities.str(o, "package-id");
}
}
}
@@ -644,7 +644,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
try {
String url = ciList.get(id);
JsonObject json = JsonTrackingParser.fetchJson(Utilities.pathURL(url, "package.manifest.json"));
- String currDate = JSONUtil.str(json, "date");
+ String currDate = JsonUtilities.str(json, "date");
String packDate = p.date();
if (!currDate.equals(packDate)) {
return null; // nup, we need a new copy
@@ -740,13 +740,13 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
throw new FHIRException("Error fetching package directly (" + pv + "), or fetching package list for " + id + " from " + pu + ": " + e1.getMessage(), e1);
}
}
- if (!id.equals(JSONUtil.str(json, "package-id")))
- throw new FHIRException("Package ids do not match in " + pu + ": " + id + " vs " + JSONUtil.str(json, "package-id"));
+ if (!id.equals(JsonUtilities.str(json, "package-id")))
+ throw new FHIRException("Package ids do not match in " + pu + ": " + id + " vs " + JsonUtilities.str(json, "package-id"));
for (JsonElement e : json.getAsJsonArray("list")) {
JsonObject vo = (JsonObject) e;
- if (v.equals(JSONUtil.str(vo, "version"))) {
- aurl = Utilities.pathURL(JSONUtil.str(vo, "path"), "package.tgz");
- String u = Utilities.pathURL(JSONUtil.str(vo, "path"), "package.tgz");
+ if (v.equals(JsonUtilities.str(vo, "version"))) {
+ aurl = Utilities.pathURL(JsonUtilities.str(vo, "path"), "package.tgz");
+ String u = Utilities.pathURL(JsonUtilities.str(vo, "path"), "package.tgz");
return new InputStreamWithSrc(fetchFromUrlSpecific(u, true), u, v);
}
}
@@ -771,12 +771,12 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
}
String pu = Utilities.pathURL(url, "package-list.json");
JsonObject json = JsonTrackingParser.fetchJson(pu);
- if (!id.equals(JSONUtil.str(json, "package-id")))
- throw new FHIRException("Package ids do not match in " + pu + ": " + id + " vs " + JSONUtil.str(json, "package-id"));
+ if (!id.equals(JsonUtilities.str(json, "package-id")))
+ throw new FHIRException("Package ids do not match in " + pu + ": " + id + " vs " + JsonUtilities.str(json, "package-id"));
for (JsonElement e : json.getAsJsonArray("list")) {
JsonObject vo = (JsonObject) e;
- if (JSONUtil.bool(vo, "current")) {
- return JSONUtil.str(vo, "version");
+ if (JsonUtilities.bool(vo, "current")) {
+ return JsonUtilities.str(vo, "version");
}
}
diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java
index 876cbb35a..6bcd50c7a 100644
--- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java
+++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java
@@ -67,7 +67,7 @@ import org.hl7.fhir.utilities.SimpleHTTPClient;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.SimpleHTTPClient.HTTPResult;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.NpmPackage.ITransformingLoader;
import org.hl7.fhir.utilities.npm.NpmPackage.PackageResourceInformationSorter;
@@ -113,12 +113,12 @@ public class NpmPackage {
public PackageResourceInformation(String root, JsonObject fi) throws IOException {
super();
- id = JSONUtil.str(fi, "id");
- type = JSONUtil.str(fi, "resourceType");
- url = JSONUtil.str(fi, "url");
- version = JSONUtil.str(fi, "version");
- filename = Utilities.path(root, JSONUtil.str(fi, "filename"));
- supplements = JSONUtil.str(fi, "supplements");
+ id = JsonUtilities.str(fi, "id");
+ type = JsonUtilities.str(fi, "resourceType");
+ url = JsonUtilities.str(fi, "url");
+ version = JsonUtilities.str(fi, "version");
+ filename = Utilities.path(root, JsonUtilities.str(fi, "filename"));
+ supplements = JsonUtilities.str(fi, "supplements");
}
public String getId() {
return id;
@@ -144,8 +144,8 @@ public class NpmPackage {
@Override
public int compare(JsonObject o0, JsonObject o1) {
- String v0 = JSONUtil.str(o0, "version");
- String v1 = JSONUtil.str(o1, "version");
+ String v0 = JsonUtilities.str(o0, "version");
+ String v1 = JsonUtilities.str(o1, "version");
return v0.compareTo(v1);
}
}
@@ -185,8 +185,8 @@ public class NpmPackage {
this.index = index;
for (JsonElement e : index.getAsJsonArray("files")) {
JsonObject file = (JsonObject) e;
- String type = JSONUtil.str(file, "resourceType");
- String name = JSONUtil.str(file, "filename");
+ String type = JsonUtilities.str(file, "resourceType");
+ String name = JsonUtilities.str(file, "filename");
if (!types.containsKey(type))
types.put(type, new ArrayList<>());
types.get(type).add(name);
@@ -326,7 +326,8 @@ public class NpmPackage {
}
public static boolean isInternalExemptFile(File f) {
- return Utilities.existsInList(f.getName(), ".git", ".svn") || Utilities.existsInList(f.getName(), "package-list.json");
+ return Utilities.existsInList(f.getName(), ".git", ".svn", ".DS_Store") || Utilities.existsInList(f.getName(), "package-list.json") ||
+ Utilities.endsWithInList(f.getName(), ".tgz");
}
private void loadSubFolders(String rootPath, File dir) throws IOException {
@@ -552,7 +553,7 @@ public class NpmPackage {
if (folder.index != null) {
for (JsonElement e : folder.index.getAsJsonArray("files")) {
JsonObject fi = e.getAsJsonObject();
- if (Utilities.existsInList(JSONUtil.str(fi, "resourceType"), types)) {
+ if (Utilities.existsInList(JsonUtilities.str(fi, "resourceType"), types)) {
res.add(new PackageResourceInformation(folder.folder.getAbsolutePath(), fi));
}
}
@@ -625,19 +626,19 @@ public class NpmPackage {
List matches = new ArrayList<>();
for (JsonElement e : f.index.getAsJsonArray("files")) {
JsonObject file = (JsonObject) e;
- if (canonical.equals(JSONUtil.str(file, "url"))) {
- if (version != null && version.equals(JSONUtil.str(file, "version"))) {
- return load("package", JSONUtil.str(file, "filename"));
+ if (canonical.equals(JsonUtilities.str(file, "url"))) {
+ if (version != null && version.equals(JsonUtilities.str(file, "version"))) {
+ return load("package", JsonUtilities.str(file, "filename"));
} else if (version == null) {
matches.add(file);
}
}
if (matches.size() > 0) {
if (matches.size() == 1) {
- return load("package", JSONUtil.str(matches.get(0), "filename"));
+ return load("package", JsonUtilities.str(matches.get(0), "filename"));
} else {
Collections.sort(matches, new IndexVersionSorter());
- return load("package", JSONUtil.str(matches.get(matches.size()-1), "filename"));
+ return load("package", JsonUtilities.str(matches.get(matches.size()-1), "filename"));
}
}
}
@@ -697,7 +698,7 @@ public class NpmPackage {
* @return
*/
public String name() {
- return JSONUtil.str(npm, "name");
+ return JsonUtilities.str(npm, "name");
}
/**
@@ -705,15 +706,15 @@ public class NpmPackage {
* @return
*/
public String id() {
- return JSONUtil.str(npm, "name");
+ return JsonUtilities.str(npm, "name");
}
public String date() {
- return JSONUtil.str(npm, "date");
+ return JsonUtilities.str(npm, "date");
}
public String canonical() {
- return JSONUtil.str(npm, "canonical");
+ return JsonUtilities.str(npm, "canonical");
}
/**
@@ -721,7 +722,7 @@ public class NpmPackage {
* @return
*/
public String version() {
- return JSONUtil.str(npm, "version");
+ return JsonUtilities.str(npm, "version");
}
/**
@@ -729,11 +730,11 @@ public class NpmPackage {
* @return
*/
public String fhirVersion() {
- if ("hl7.fhir.core".equals(JSONUtil.str(npm, "name")))
- return JSONUtil.str(npm, "version");
- else if (JSONUtil.str(npm, "name").startsWith("hl7.fhir.r2.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r2b.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r3.") ||
- JSONUtil.str(npm, "name").startsWith("hl7.fhir.r4.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r4b.") || JSONUtil.str(npm, "name").startsWith("hl7.fhir.r5."))
- return JSONUtil.str(npm, "version");
+ if ("hl7.fhir.core".equals(JsonUtilities.str(npm, "name")))
+ return JsonUtilities.str(npm, "version");
+ else if (JsonUtilities.str(npm, "name").startsWith("hl7.fhir.r2.") || JsonUtilities.str(npm, "name").startsWith("hl7.fhir.r2b.") || JsonUtilities.str(npm, "name").startsWith("hl7.fhir.r3.") ||
+ JsonUtilities.str(npm, "name").startsWith("hl7.fhir.r4.") || JsonUtilities.str(npm, "name").startsWith("hl7.fhir.r4b.") || JsonUtilities.str(npm, "name").startsWith("hl7.fhir.r5."))
+ return JsonUtilities.str(npm, "version");
else {
JsonObject dep = null;
if (npm.has("dependencies") && npm.get("dependencies").isJsonObject()) {
@@ -778,11 +779,11 @@ public class NpmPackage {
}
public String type() {
- return JSONUtil.str(npm, "type");
+ return JsonUtilities.str(npm, "type");
}
public String description() {
- return JSONUtil.str(npm, "description");
+ return JsonUtilities.str(npm, "description");
}
public String getPath() {
@@ -800,24 +801,24 @@ public class NpmPackage {
}
public String homepage() {
- return JSONUtil.str(npm, "homepage");
+ return JsonUtilities.str(npm, "homepage");
}
public String url() {
- return JSONUtil.str(npm, "url");
+ return JsonUtilities.str(npm, "url");
}
public String title() {
- return JSONUtil.str(npm, "title");
+ return JsonUtilities.str(npm, "title");
}
public String toolsVersion() {
- return JSONUtil.str(npm, "tools-version");
+ return JsonUtilities.str(npm, "tools-version");
}
public String license() {
- return JSONUtil.str(npm, "license");
+ return JsonUtilities.str(npm, "license");
}
// /**
@@ -833,7 +834,7 @@ public class NpmPackage {
if (npm.has("url") && npm.get("url").isJsonPrimitive()) {
return PackageHacker.fixPackageUrl(npm.get("url").getAsString());
} else {
- return JSONUtil.str(npm, "canonical");
+ return JsonUtilities.str(npm, "canonical");
}
}
@@ -842,8 +843,8 @@ public class NpmPackage {
JsonArray files = f.index.getAsJsonArray("files");
for (JsonElement e : files) {
JsonObject i = (JsonObject) e;
- if (type.equals(JSONUtil.str(i, "resourceType")) && id.equals(JSONUtil.str(i, "id"))) {
- return load("package", JSONUtil.str(i, "filename"));
+ if (type.equals(JsonUtilities.str(i, "resourceType")) && id.equals(JsonUtilities.str(i, "id"))) {
+ return load("package", JsonUtilities.str(i, "filename"));
}
}
return null;
@@ -858,8 +859,8 @@ public class NpmPackage {
JsonArray files = f.index.getAsJsonArray("files");
for (JsonElement e : files) {
JsonObject i = (JsonObject) e;
- if (type.equals(JSONUtil.str(i, "resourceType")) && id.equals(JSONUtil.str(i, "id"))) {
- return load("example", JSONUtil.str(i, "filename"));
+ if (type.equals(JsonUtilities.str(i, "resourceType")) && id.equals(JsonUtilities.str(i, "id"))) {
+ return load("example", JsonUtilities.str(i, "filename"));
}
}
}
@@ -1094,7 +1095,7 @@ public class NpmPackage {
}
public boolean isCore() {
- return Utilities.existsInList(JSONUtil.str(npm, "type"), "fhir.core", "Core");
+ return Utilities.existsInList(JsonUtilities.str(npm, "type"), "fhir.core", "Core");
}
public boolean hasCanonical(String url) {
@@ -1107,8 +1108,8 @@ public class NpmPackage {
if (folder != null) {
for (JsonElement e : folder.index.getAsJsonArray("files")) {
JsonObject o = (JsonObject) e;
- if (u.equals(JSONUtil.str(o, "url"))) {
- if (v == null || v.equals(JSONUtil.str(o, "version"))) {
+ if (u.equals(JsonUtilities.str(o, "url"))) {
+ if (v == null || v.equals(JsonUtilities.str(o, "version"))) {
return true;
}
}
@@ -1126,7 +1127,7 @@ public class NpmPackage {
if (Utilities.existsInList(name(), "fhir.test.data.r2", "fhir.test.data.r3", "fhir.test.data.r4", "fhir.tx.support.r2", "fhir.tx.support.r3", "fhir.tx.support.r4", "us.nlm.vsac")) {
return true;
}
- if (JSONUtil.bool(npm, "lazy-load")) {
+ if (JsonUtilities.bool(npm, "lazy-load")) {
return true;
}
if (!hasFile("other", "spec.internals")) {
@@ -1136,7 +1137,7 @@ public class NpmPackage {
}
public boolean isNotForPublication() {
- return JSONUtil.bool(npm, "notForPublication");
+ return JsonUtilities.bool(npm, "notForPublication");
}
public InputStream load(PackageResourceInformation p) throws FileNotFoundException {
diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageClient.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageClient.java
index 68e89012b..71e0fac17 100644
--- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageClient.java
+++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageClient.java
@@ -9,7 +9,7 @@ import org.hl7.fhir.utilities.SimpleHTTPClient.HTTPResult;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import java.io.ByteArrayInputStream;
@@ -81,12 +81,12 @@ public class PackageClient {
if (versions != null) {
for (String v : sorted(versions.keySet())) {
JsonObject obj = versions.getAsJsonObject(v);
- res.add(new PackageInfo(JSONUtil.str(obj, "Name", "name"),
- JSONUtil.str(obj, "Version", "version"),
- JSONUtil.str(obj, "FhirVersion", "fhirVersion"),
- JSONUtil.str(obj, "Description", "description"),
- JSONUtil.str(obj, "url"),
- JSONUtil.str(obj, "canonical"),
+ res.add(new PackageInfo(JsonUtilities.str(obj, "Name", "name"),
+ JsonUtilities.str(obj, "Version", "version"),
+ JsonUtilities.str(obj, "FhirVersion", "fhirVersion"),
+ JsonUtilities.str(obj, "Description", "description"),
+ JsonUtilities.str(obj, "url"),
+ JsonUtilities.str(obj, "canonical"),
address));
}
}
@@ -121,12 +121,12 @@ public class PackageClient {
JsonArray json = fetchJsonArray(Utilities.pathURL(address, "catalog?")+params.toString());
for (JsonElement e : json) {
JsonObject obj = (JsonObject) e;
- res.add(new PackageInfo(JSONUtil.str(obj, "Name", "name"),
- JSONUtil.str(obj, "Version", "version"),
- JSONUtil.str(obj, "FhirVersion", "fhirVersion"),
- JSONUtil.str(obj, "Description", "description"),
- JSONUtil.str(obj, "url"),
- JSONUtil.str(obj, "canonical"),
+ res.add(new PackageInfo(JsonUtilities.str(obj, "Name", "name"),
+ JsonUtilities.str(obj, "Version", "version"),
+ JsonUtilities.str(obj, "FhirVersion", "fhirVersion"),
+ JsonUtilities.str(obj, "Description", "description"),
+ JsonUtilities.str(obj, "url"),
+ JsonUtilities.str(obj, "canonical"),
address));
}
} catch (IOException e1) {
@@ -192,10 +192,10 @@ public class PackageClient {
}
protected PackageInfo getPackageInfoFromJSON(JsonObject o, String name, String canonical, String fhirVersion) {
- String id = JSONUtil.str(o, "npm-name");
- String pname = JSONUtil.str(o, "name");
- String pcanonical = JSONUtil.str(o, "canonical");
- String description = JSONUtil.str(o, "description");
+ String id = JsonUtilities.str(o, "npm-name");
+ String pname = JsonUtilities.str(o, "name");
+ String pcanonical = JsonUtilities.str(o, "canonical");
+ String description = JsonUtilities.str(o, "description");
boolean ok = true;
if (ok && !Utilities.noString(name)) {
ok = (pname != null && pname.contains(name)) || (description != null && description.contains(name)) || (id != null && id.contains(name));
@@ -209,15 +209,15 @@ public class PackageClient {
if (ok) {
// if we can find something...
- for (JsonObject e : JSONUtil.objects(o, "editions")) {
- if (fhirVersion == null || fhirVersion.equals(JSONUtil.str(e, "fhir-version"))) {
- String v = JSONUtil.str(e, "ig-version");
+ for (JsonObject e : JsonUtilities.objects(o, "editions")) {
+ if (fhirVersion == null || fhirVersion.equals(JsonUtilities.str(e, "fhir-version"))) {
+ String v = JsonUtilities.str(e, "ig-version");
if (version == null || VersionUtilities.isThisOrLater(version, v)) {
version = v;
fVersion = e.getAsJsonArray("fhir-version").get(0).getAsString();
- url = JSONUtil.str(e, "url");
+ url = JsonUtilities.str(e, "url");
- String npmPackage = JSONUtil.str(e, "package");
+ String npmPackage = JsonUtilities.str(e, "package");
if (npmPackage != null && id == null) {
id = npmPackage.substring(0, npmPackage.indexOf("#"));
}
@@ -231,7 +231,7 @@ public class PackageClient {
public List listFromRegistry(String name, String canonical, String fhirVersion) throws IOException {
List result = new ArrayList<>();
JsonObject packages = JsonTrackingParser.fetchJson("https://raw.githubusercontent.com/FHIR/ig-registry/master/fhir-ig-list.json?nocache=" + System.currentTimeMillis());
- for (JsonObject o : JSONUtil.objects(packages, "guides")) {
+ for (JsonObject o : JsonUtilities.objects(packages, "guides")) {
if (o.has("canonical")) {
final PackageInfo packageInfo = getPackageInfoFromJSON(o, name, canonical, fhirVersion);
if (packageInfo.getVersion() != null) {
@@ -249,7 +249,7 @@ public class PackageClient {
JsonArray json = fetchJsonArray(Utilities.pathURL(address, "catalog?")+params.toString());
for (JsonElement e : json) {
JsonObject obj = (JsonObject) e;
- list.add(JSONUtil.str(obj, "Name", "name"));
+ list.add(JsonUtilities.str(obj, "Name", "name"));
}
} catch (IOException e1) {
}
diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java
index 3c3d6b110..8af672e06 100644
--- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java
+++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageHacker.java
@@ -5,6 +5,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -27,7 +28,7 @@ public class PackageHacker {
private static boolean useSecureReferences = false;
public static void main(String[] args) throws FileNotFoundException, IOException {
- new PackageHacker().edit("/Users/grahamegrieve/work/test-cases/validator/swiss.mednet.fhir#0.5.0.tgz");
+ new PackageHacker().edit(args[0]);
}
private void edit(String name) throws FileNotFoundException, IOException {
@@ -39,7 +40,14 @@ public class PackageHacker {
System.out.println("Altering Package "+f.getAbsolutePath());
System.out.println(nice(pck.getNpm()));
- change(pck.getNpm(), pck.getFolders().get("package").getContent());
+ change(pck.getNpm());
+ fixContent(pck.getFolders().get("package").getContent());
+ if (pck.getFolders().containsKey("openapi")) {
+ fixContent(pck.getFolders().get("openapi").getContent());
+ }
+ if (pck.getFolders().containsKey("xml")) {
+ fixContent(pck.getFolders().get("xml").getContent());
+ }
System.out.println("Revised Package");
System.out.println("=======================");
@@ -53,11 +61,16 @@ public class PackageHacker {
}
}
+ private void fixContent(Map content) {
+ fixVersionInContent(content);
+
+ }
+
private String nice(JsonObject json) {
return new GsonBuilder().setPrettyPrinting().create().toJson(json);
}
- private void change(JsonObject npm, Map content) throws FileNotFoundException, IOException {
+ private void change(JsonObject npm) throws FileNotFoundException, IOException {
fixVersions(npm);
// npm.remove("notForPublication");
// npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1");
@@ -67,21 +80,36 @@ public class PackageHacker {
// npm.addProperty("canonical", "http://hl7.org/fhir/us/davinci-drug-formulary");
//// npm.remove("description");
//// npm.addProperty("description", "Group Wrapper that includes all the R4 packages");
-// npm.remove("url");
-// npm.addProperty("url", "https://terminology.hl7.org/1.0.0/");
- npm.remove("dependencies");
- JsonObject dep = new JsonObject();
- npm.add("dependencies", dep);
- dep.addProperty("hl7.fhir.r4.core", "4.0.1");
- dep.addProperty("ch.fhir.ig.ch-core", "2.0.0");
- dep.addProperty("ch.fhir.ig.ch-epr-term", "2.0.4");
- dep.addProperty("ch.fhir.ig.ch-emed","current");
+ npm.remove("url");
+ npm.addProperty("url", "http://hl7.org/fhir/R4B");
+ npm.remove("homepage");
+ npm.addProperty("homepage", "http://hl7.org/fhir/R4B");
+// npm.remove("dependencies");
+// JsonObject dep = new JsonObject();
+// npm.add("dependencies", dep);
+// dep.addProperty("hl7.fhir.r4.core", "4.0.1");
+// dep.addProperty("ch.fhir.ig.ch-core", "2.0.0");
+// dep.addProperty("ch.fhir.ig.ch-epr-term", "2.0.4");
+// dep.addProperty("ch.fhir.ig.ch-emed","current");
// dep.addProperty("hl7.fhir.r4.examples", "4.0.1");
// dep.addProperty("hl7.fhir.r4.expansions", "4.0.1");
// dep.addProperty("hl7.fhir.r4.elements", "4.0.1");
}
+ private void fixVersionInContent(Map content) {
+ for (String n : content.keySet()) {
+ if (n.endsWith(".json") || n.endsWith(".xml") || n.endsWith(".xsd")) {
+ String json = new String(content.get(n));
+ if (json.contains("4.3.0-cibuild") && !json.contains("4.3.0-snapshot1")) {
+ json = json.replace("4.3.0-cibuild", "4.3.0");
+ content.put(n, json.getBytes(StandardCharsets.UTF_8));
+ }
+ }
+ }
+
+ }
+
private void fixVersions(JsonObject npm) {
npm.remove("fhirVersions");
JsonArray a = new JsonArray();
diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageScanner.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageScanner.java
index d08489940..e2fb6001f 100644
--- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageScanner.java
+++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/PackageScanner.java
@@ -9,7 +9,7 @@ import java.util.Set;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import com.google.gson.JsonObject;
@@ -63,7 +63,7 @@ public class PackageScanner {
} catch (Exception e) {
fv = "--";
}
- output.add(pck.name()+"\t"+pck.version()+"\t"+pck.canonical()+"\t"+fv+'\t'+pck.fhirVersionList()+'\t'+JSONUtil.str(json, "kind")+'\t'+JSONUtil.str(json, "type")+'\t'+JsonTrackingParser.writeDense(json)); } catch (Exception e) {
+ output.add(pck.name()+"\t"+pck.version()+"\t"+pck.canonical()+"\t"+fv+'\t'+pck.fhirVersionList()+'\t'+JsonUtilities.str(json, "kind")+'\t'+JsonUtilities.str(json, "type")+'\t'+JsonTrackingParser.writeDense(json)); } catch (Exception e) {
System.out.println("Error acessing "+pi.getId()+"#"+piv.getVersion()+": "+e.getMessage());
e.printStackTrace();
}
diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/ResourceRenamer.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/ResourceRenamer.java
new file mode 100644
index 000000000..700aeaece
--- /dev/null
+++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/ResourceRenamer.java
@@ -0,0 +1,59 @@
+package org.hl7.fhir.utilities.npm;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.hl7.fhir.utilities.Utilities;
+import org.hl7.fhir.utilities.json.JsonUtilities;
+import org.hl7.fhir.utilities.json.JsonTrackingParser;
+
+import com.google.gson.JsonObject;
+
+public class ResourceRenamer {
+
+ public static void main(String[] args) throws IOException {
+ new ResourceRenamer().processArg(new File(args[0]));
+ }
+
+ private void processArg(File file) throws IOException {
+ if (file.isDirectory()) {
+ process(file);
+ } else {
+ unbundle(file);
+ }
+ }
+
+ private void unbundle(File f) throws IOException {
+ JsonObject j = JsonTrackingParser.parseJson(f);
+ for (JsonObject e : JsonUtilities.objects(j, "entry")) {
+ JsonObject r = e.getAsJsonObject("resource");
+ String rt = r.get("resourceType").getAsString();
+ String id = r.get("id").getAsString();
+ String nn = Utilities.path(Utilities.getDirectoryForFile(f.getAbsolutePath()), rt+"-"+id+".json");
+ JsonTrackingParser.write(r, new File(nn), true);
+ }
+ }
+
+ private void process(File dir) {
+
+ for (File f : dir.listFiles()) {
+ if (f.getName().endsWith(".json")) {
+ try {
+ JsonObject j = JsonTrackingParser.parseJson(f);
+ String rt = j.get("resourceType").getAsString();
+ String id = j.get("id").getAsString();
+ String nn = Utilities.path(Utilities.getDirectoryForFile(f.getAbsolutePath()), rt+"-"+id+".json");
+ File nf = new File(nn);
+ if (!nn.equals(f.getAbsolutePath())) {
+ System.out.println("Rename "+f.getName()+" to "+nf.getName());
+ f.renameTo(nf);
+ }
+ } catch (Exception e) {
+ System.out.println("Error Processing "+f.getName()+" : "+e.getMessage());
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java
index 63a816ff2..a6c98f888 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java
@@ -24,7 +24,7 @@ import org.hl7.fhir.utilities.IniFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ResourceChecker.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ResourceChecker.java
index 1422b9810..c1695232c 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ResourceChecker.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ResourceChecker.java
@@ -8,7 +8,7 @@ import org.hl7.fhir.r5.elementmodel.SHCParser.JWT;
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import com.google.gson.JsonObject;
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java
index 0f77fdea1..a8e4b5a24 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java
@@ -158,6 +158,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
@Getter @Setter private boolean crumbTrails;
@Getter @Setter private boolean allowExampleUrls;
@Getter @Setter private boolean showMessagesFromReferences;
+ @Getter @Setter private boolean doImplicitFHIRPathStringConversion;
@Getter @Setter private Locale locale;
@Getter @Setter private List igs = new ArrayList<>();
@Getter @Setter private List extensionDomains = new ArrayList<>();
@@ -623,6 +624,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
validator.setQuestionnaireMode(questionnaireMode);
validator.setLevel(level);
validator.setNoUnicodeBiDiControlChars(noUnicodeBiDiControlChars);
+ validator.setDoImplicitFHIRPathStringConversion(doImplicitFHIRPathStringConversion);
if (format == FhirFormat.SHC) {
igLoader.loadIg(getIgs(), getBinaries(), SHCParser.CURRENT_PACKAGE, true);
}
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java
index 45c40033d..49630d9bd 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java
@@ -46,6 +46,8 @@ public class CliContext {
private boolean noInvariants = false;
@JsonProperty("wantInvariantsInMessages")
private boolean wantInvariantsInMessages = false;
+ @JsonProperty("doImplicitFHIRPathStringConversion")
+ private boolean doImplicitFHIRPathStringConversion = false;
@JsonProperty("map")
private String map = null;
@@ -233,6 +235,16 @@ public class CliContext {
return this;
}
+ @JsonProperty("doImplicitFHIRPathStringConversion")
+ public boolean isDoImplicitFHIRPathStringConversion() {
+ return doImplicitFHIRPathStringConversion;
+ }
+
+ @JsonProperty("doImplicitFHIRPathStringConversion")
+ public void setDoImplicitFHIRPathStringConversion(boolean doImplicitFHIRPathStringConversion) {
+ this.doImplicitFHIRPathStringConversion = doImplicitFHIRPathStringConversion;
+ }
+
@JsonProperty("locale")
public String getLanguageCode() {
return locale;
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/StandAloneValidatorFetcher.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/StandAloneValidatorFetcher.java
index 5e6510933..7e6e6d4fe 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/StandAloneValidatorFetcher.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/StandAloneValidatorFetcher.java
@@ -21,7 +21,7 @@ import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.VersionUtilities.VersionURLInfo;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
@@ -165,8 +165,8 @@ public class StandAloneValidatorFetcher implements IValidatorResourceFetcher, IV
JsonObject json;
try {
json = JsonTrackingParser.fetchJson("http://hl7.org/fhir/mappingspaces.json");
- for (JsonObject ms : JSONUtil.objects(json, "spaces")) {
- mappingsUris.add(JSONUtil.str(ms, "url"));
+ for (JsonObject ms : JsonUtilities.objects(json, "spaces")) {
+ mappingsUris.add(JsonUtilities.str(ms, "url"));
}
} catch (IOException e) {
// frozen R4 list
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/ValidationService.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/ValidationService.java
index 80c020537..73a60e5ee 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/ValidationService.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/services/ValidationService.java
@@ -354,6 +354,7 @@ public class ValidationService {
validator.setSnomedExtension(cliContext.getSnomedCTCode());
validator.setAssumeValidRestReferences(cliContext.isAssumeValidRestReferences());
validator.setShowMessagesFromReferences(cliContext.isShowMessagesFromReferences());
+ validator.setDoImplicitFHIRPathStringConversion(cliContext.isDoImplicitFHIRPathStringConversion());
validator.setNoExtensibleBindingMessages(cliContext.isNoExtensibleBindingMessages());
validator.setNoUnicodeBiDiControlChars(cliContext.isNoUnicodeBiDiControlChars());
validator.setNoInvariantChecks(cliContext.isNoInvariants());
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/utils/Params.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/utils/Params.java
index 640b22b16..e96a99853 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/utils/Params.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/utils/Params.java
@@ -68,6 +68,7 @@ public class Params {
public static final String SHOW_TIMES = "-show-times";
public static final String ALLOW_EXAMPLE_URLS = "-allow-example-urls";
public static final String OUTPUT_STYLE = "-output-style";
+ public static final String DO_IMPLICIT_FHIRPATH_STRING_CONVERSION = "-implicit-fhirpath-string-conversions";
private static final Object JURISDICTION = "-jurisdiction";
/**
@@ -167,6 +168,8 @@ public class Params {
cliContext.setRecursive(true);
} else if (args[i].equals(SHOW_MESSAGES_FROM_REFERENCES)) {
cliContext.setShowMessagesFromReferences(true);
+ } else if (args[i].equals(DO_IMPLICIT_FHIRPATH_STRING_CONVERSION)) {
+ cliContext.setDoImplicitFHIRPathStringConversion(true);
} else if (args[i].equals(LOCALE)) {
if (i + 1 == args.length) {
throw new Error("Specified -locale without indicating locale");
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java
index f77b61979..63a0d2bb8 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java
@@ -544,6 +544,14 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
this.crumbTrails = crumbTrails;
}
+ public boolean isDoImplicitFHIRPathStringConversion() {
+ return fpe.isDoImplicitStringConversion();
+ }
+
+ public void setDoImplicitFHIRPathStringConversion(boolean doImplicitFHIRPathStringConversion) {
+ fpe.setDoImplicitStringConversion(doImplicitFHIRPathStringConversion);
+ }
+
private boolean allowUnknownExtension(String url) {
if ((allowExamples && (url.contains("example.org") || url.contains("acme.com"))) || url.contains("nema.org") || url.startsWith("http://hl7.org/fhir/tools/StructureDefinition/") || url.equals("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression"))
// Added structuredefinition-expression explicitly because it wasn't defined in the version of the spec it needs to be used with
diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java
index 434701498..47d568409 100644
--- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java
+++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java
@@ -56,7 +56,7 @@ import org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher;
import org.hl7.fhir.r5.utils.validation.constants.ContainedReferenceValidationPolicy;
import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy;
import org.hl7.fhir.utilities.SimpleHTTPClient.HTTPResult;
-import org.hl7.fhir.utilities.json.JSONUtil;
+import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
@@ -91,7 +91,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
manifest = (JsonObject) new com.google.gson.JsonParser().parse(contents);
for (JsonElement e : manifest.getAsJsonArray("test-cases")) {
JsonObject o = (JsonObject) e;
- examples.put(JSONUtil.str(o, "name"), o);
+ examples.put(JsonUtilities.str(o, "name"), o);
}
List names = new ArrayList(examples.size());
@@ -168,7 +168,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
if (content.has("use-test") && !content.get("use-test").getAsBoolean())
return;
- byte[] testCaseContent = TestingUtilities.loadTestResource("validator", JSONUtil.str(content, "file")).getBytes(StandardCharsets.UTF_8);
+ byte[] testCaseContent = TestingUtilities.loadTestResource("validator", JsonUtilities.str(content, "file")).getBytes(StandardCharsets.UTF_8);
// load and process content
FhirFormat fmt = determineFormat(content, testCaseContent);
@@ -177,7 +177,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
val.getContext().setClientRetryCount(4);
val.setDebug(false);
- if (content.has("fetcher") && "standalone".equals(JSONUtil.str(content, "fetcher"))) {
+ if (content.has("fetcher") && "standalone".equals(JsonUtilities.str(content, "fetcher"))) {
val.setFetcher(vCurr);
vCurr.setFetcher(new StandAloneValidatorFetcher(vCurr.getPcm(), vCurr.getContext(), vCurr));
} else {
@@ -337,8 +337,8 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
private FhirFormat determineFormat(JsonObject config, byte[] cnt) throws IOException {
- String name = JSONUtil.str(config, "file");
- return org.hl7.fhir.validation.ResourceChecker.checkIsResource(vCurr.getContext(), true, cnt, name, !JSONUtil.bool(config, "guess-format"));
+ String name = JsonUtilities.str(config, "file");
+ return org.hl7.fhir.validation.ResourceChecker.checkIsResource(vCurr.getContext(), true, cnt, name, !JsonUtilities.bool(config, "guess-format"));
}
private List asSdList(StructureDefinition sd) {
diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/4.5.0/snomed.cache b/org.hl7.fhir.validation/src/test/resources/txCache/4.5.0/snomed.cache
index fa1642254..62e83f63b 100644
--- a/org.hl7.fhir.validation/src/test/resources/txCache/4.5.0/snomed.cache
+++ b/org.hl7.fhir.validation/src/test/resources/txCache/4.5.0/snomed.cache
@@ -203,3 +203,17 @@ v: {
"system" : "http://snomed.info/sct"
}
-------------------------------------------------------------------------------------
+{"code" : {
+ "system" : "http://snomed.info/sct",
+ "version" : "http://snomed.info/sct/11000172109/version/20210915",
+ "code" : "132037003",
+ "display" : "Pineywoods pig breed. Not."
+}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}####
+v: {
+ "display" : "Pineywoods pig",
+ "code" : "132037003",
+ "system" : "http://snomed.info/sct",
+ "severity" : "warning",
+ "error" : "The display \"Pineywoods pig breed. Not.\" is not a valid display for the code {http://snomed.info/sct}132037003 - should be one of ['Pineywoods pig', 'Pineywoods pig breed (organism)', 'Pineywoods pig breed'] (from http://tx.fhir.org/r4)"
+}
+-------------------------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b167c900d..337d3e439 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
5.4.0
- 1.1.100
+ 1.1.101-SNAPSHOT
5.7.1
1.7.1
3.0.0-M5