prepare release

This commit is contained in:
Grahame Grieve 2022-11-16 18:36:02 -03:00
parent 011e2488a3
commit 47443acaf3
6 changed files with 22 additions and 19 deletions

View File

@ -19,12 +19,11 @@ import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser; import org.hl7.fhir.utilities.json.model.JsonElement;
import org.hl7.fhir.utilities.json.model.JsonObject;
import org.hl7.fhir.utilities.json.parser.JsonParser;
import org.hl7.fhir.utilities.npm.PackageHacker; import org.hl7.fhir.utilities.npm.PackageHacker;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
public class XVerExtensionManager { public class XVerExtensionManager {
public enum XVerExtensionStatus { public enum XVerExtensionStatus {
@ -54,7 +53,7 @@ public class XVerExtensionManager {
if (!lists.containsKey(v)) { if (!lists.containsKey(v)) {
if (context.hasBinaryKey("xver-paths-"+v+".json")) { if (context.hasBinaryKey("xver-paths-"+v+".json")) {
try { try {
lists.put(v, JsonTrackingParser.parseJson(context.getBinaryForKey("xver-paths-"+v+".json"))); lists.put(v, JsonParser.parseObject(context.getBinaryForKey("xver-paths-"+v+".json")));
} catch (IOException e1) { } catch (IOException e1) {
throw new FHIRException(e); throw new FHIRException(e);
} }
@ -63,9 +62,9 @@ public class XVerExtensionManager {
} }
} }
JsonObject root = lists.get(v); JsonObject root = lists.get(v);
JsonObject path = root.getAsJsonObject(e); JsonObject path = root.getObj(e);
if (path == null) { if (path == null) {
path = root.getAsJsonObject(e+"[x]"); path = root.getObj(e+"[x]");
} }
if (path == null) { if (path == null) {
return XVerExtensionStatus.Unknown; return XVerExtensionStatus.Unknown;
@ -86,9 +85,9 @@ public class XVerExtensionManager {
String verTarget = VersionUtilities.getMajMin(context.getVersion()); String verTarget = VersionUtilities.getMajMin(context.getVersion());
String e = url.substring(54); String e = url.substring(54);
JsonObject root = lists.get(verSource); JsonObject root = lists.get(verSource);
JsonObject path = root.getAsJsonObject(e); JsonObject path = root.getObj(e);
if (path == null) { if (path == null) {
path = root.getAsJsonObject(e+"[x]"); path = root.getObj(e+"[x]");
} }
StructureDefinition sd = new StructureDefinition(); StructureDefinition sd = new StructureDefinition();
@ -116,10 +115,10 @@ public class XVerExtensionManager {
ElementDefinition val = sd.getDifferential().addElement().setPath("Extension.value[x]").setMin(1); ElementDefinition val = sd.getDifferential().addElement().setPath("Extension.value[x]").setMin(1);
populateTypes(path, val, verSource, verTarget); populateTypes(path, val, verSource, verTarget);
} else if (path.has("elements")) { } else if (path.has("elements")) {
for (JsonElement i : path.getAsJsonArray("elements")) { for (JsonElement i : path.getArr("elements").getItems()) {
JsonObject elt = root.getAsJsonObject(e+"."+i.getAsString()); JsonObject elt = root.getObj(e+"."+i.toString());
if (elt != null) { if (elt != null) {
String s = i.getAsString().replace("[x]", ""); String s = i.toString().replace("[x]", "");
sd.getDifferential().addElement().setPath("Extension.extension").setSliceName(s); sd.getDifferential().addElement().setPath("Extension.extension").setSliceName(s);
sd.getDifferential().addElement().setPath("Extension.extension.extension").setMax("0"); sd.getDifferential().addElement().setPath("Extension.extension.extension").setMax("0");
sd.getDifferential().addElement().setPath("Extension.extension.url").setFixed(new UriType(s)); sd.getDifferential().addElement().setPath("Extension.extension.url").setFixed(new UriType(s));
@ -135,7 +134,7 @@ public class XVerExtensionManager {
} else { } else {
throw new FHIRException("Internal error - attempt to define extension for "+url+" when it is invalid"); throw new FHIRException("Internal error - attempt to define extension for "+url+" when it is invalid");
} }
if (path.has("modifier") && path.get("modifier").getAsBoolean()) { if (path.has("modifier") && path.getBoolean("modifier")) {
ElementDefinition baseDef = new ElementDefinition("Extension"); ElementDefinition baseDef = new ElementDefinition("Extension");
sd.getDifferential().getElement().add(0, baseDef); sd.getDifferential().getElement().add(0, baseDef);
baseDef.setIsModifier(true); baseDef.setIsModifier(true);
@ -144,8 +143,8 @@ public class XVerExtensionManager {
} }
public void populateTypes(JsonObject path, ElementDefinition val, String verSource, String verTarget) { public void populateTypes(JsonObject path, ElementDefinition val, String verSource, String verTarget) {
for (JsonElement i : path.getAsJsonArray("types")) { for (JsonElement i : path.getArr("types").getItems()) {
String s = i.getAsString(); String s = i.toString();
if (!s.startsWith("!")) { if (!s.startsWith("!")) {
if (s.contains("(")) { if (s.contains("(")) {
String t = s.substring(0, s.indexOf("(")); String t = s.substring(0, s.indexOf("("));

View File

@ -1,6 +1,8 @@
package org.hl7.fhir.utilities.json; package org.hl7.fhir.utilities.json;
public class JsonException extends Exception { import org.hl7.fhir.exceptions.FHIRException;
public class JsonException extends FHIRException {
public JsonException(String msg) { public JsonException(String msg) {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub

View File

@ -106,7 +106,7 @@ public class JsonObject extends JsonElement {
} }
public Boolean getBoolean(String name) { public Boolean getBoolean(String name) {
return ((JsonBoolean) get(name)).isValue(); return has(name) ? ((JsonBoolean) get(name)).isValue() : false;
} }
public JsonObject forceObj(String name) throws JsonException { public JsonObject forceObj(String name) throws JsonException {

View File

@ -38,6 +38,8 @@ import org.hl7.fhir.utilities.json.parser.JsonLexer.TokenType;
* * missing commas in objects and arrays * * missing commas in objects and arrays
* * comments - anything starting // will be processed as a comma to the end of the line * * comments - anything starting // will be processed as a comma to the end of the line
* *
* Other JSON5 features might be added in the future
*
* The FHIR Validator uses this parser in Json5 mode, and the object model is marked up * The FHIR Validator uses this parser in Json5 mode, and the object model is marked up
* with deviations from base JSON spec so that the validator can record them as errors * with deviations from base JSON spec so that the validator can record them as errors
* (this is better than blowing up parsing the JSON) * (this is better than blowing up parsing the JSON)

View File

@ -5787,7 +5787,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
slicingHint(errors, IssueType.INFORMATIONAL, ei.line(), ei.col(), ei.getPath(), false, isProfile(slicer) || isCritical(ei.sliceInfo), slicingHint(errors, IssueType.INFORMATIONAL, ei.line(), ei.col(), ei.getPath(), false, isProfile(slicer) || isCritical(ei.sliceInfo),
context.formatMessage(I18nConstants.THIS_ELEMENT_DOES_NOT_MATCH_ANY_KNOWN_SLICE_, context.formatMessage(I18nConstants.THIS_ELEMENT_DOES_NOT_MATCH_ANY_KNOWN_SLICE_,
profile == null ? "" : "defined in the profile " + profile.getVersionedUrl()), profile == null ? "" : "defined in the profile " + profile.getVersionedUrl()),
context.formatMessage(I18nConstants.THIS_ELEMENT_DOES_NOT_MATCH_ANY_KNOWN_SLICE_, profile == null ? "" : I18nConstants.DEFINED_IN_THE_PROFILE + profile.getVersionedUrl()) + errorSummaryForSlicingAsHtml(ei.sliceInfo), context.formatMessage(I18nConstants.THIS_ELEMENT_DOES_NOT_MATCH_ANY_KNOWN_SLICE_, profile == null ? "" : context.formatMessage(I18nConstants.DEFINED_IN_THE_PROFILE) + " "+profile.getVersionedUrl()) + errorSummaryForSlicingAsHtml(ei.sliceInfo),
errorSummaryForSlicingAsText(ei.sliceInfo)); errorSummaryForSlicingAsText(ei.sliceInfo));
} else if (ei.definition.getSlicing().getRules().equals(ElementDefinition.SlicingRules.CLOSED)) { } else if (ei.definition.getSlicing().getRules().equals(ElementDefinition.SlicingRules.CLOSED)) {
rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.getPath(), false, I18nConstants.VALIDATION_VAL_PROFILE_NOTSLICE, (profile == null ? "" : " defined in the profile " + profile.getVersionedUrl()), errorSummaryForSlicing(ei.sliceInfo)); rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.getPath(), false, I18nConstants.VALIDATION_VAL_PROFILE_NOTSLICE, (profile == null ? "" : " defined in the profile " + profile.getVersionedUrl()), errorSummaryForSlicing(ei.sliceInfo));

View File

@ -19,7 +19,7 @@
<properties> <properties>
<hapi_fhir_version>5.4.0</hapi_fhir_version> <hapi_fhir_version>5.4.0</hapi_fhir_version>
<validator_test_case_version>1.1.123-SNAPSHOT</validator_test_case_version> <validator_test_case_version>1.1.123</validator_test_case_version>
<junit_jupiter_version>5.7.1</junit_jupiter_version> <junit_jupiter_version>5.7.1</junit_jupiter_version>
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version> <junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M5</maven_surefire_version> <maven_surefire_version>3.0.0-M5</maven_surefire_version>