diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml
index a2df268bb..749a57702 100644
--- a/org.hl7.fhir.convertors/pom.xml
+++ b/org.hl7.fhir.convertors/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml
index b72fcfb1a..1bbbebf1e 100644
--- a/org.hl7.fhir.dstu2/pom.xml
+++ b/org.hl7.fhir.dstu2/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml
index 92dfe7b92..e7755258d 100644
--- a/org.hl7.fhir.dstu2016may/pom.xml
+++ b/org.hl7.fhir.dstu2016may/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml
index 5d12bae70..50bfb18de 100644
--- a/org.hl7.fhir.dstu3/pom.xml
+++ b/org.hl7.fhir.dstu3/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml
index 35d943321..45ca4a7d4 100644
--- a/org.hl7.fhir.r4/pom.xml
+++ b/org.hl7.fhir.r4/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.r5/pom.xml b/org.hl7.fhir.r5/pom.xml
index 5c24d4e4f..8235ed562 100644
--- a/org.hl7.fhir.r5/pom.xml
+++ b/org.hl7.fhir.r5/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/BaseWriter.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/BaseWriter.java
index b4277cbb4..1e01c809c 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/BaseWriter.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/BaseWriter.java
@@ -36,7 +36,7 @@ public class BaseWriter {
}
protected JsonArray forceArray(String arrayName) {
- JsonArray arr = object.get(arrayName).getAsJsonArray();
+ JsonArray arr = object.getAsJsonArray(arrayName);
if (arr == null) {
arr = new JsonArray();
object.add(arrayName, arr);
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java
index c005310ab..a556c475e 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java
@@ -116,14 +116,14 @@ public class GraphQLSchemaGenerator {
private void generateCreate(BufferedWriter writer, String name) throws IOException {
writer.write("type "+name+"CreateType {\r\n");
writer.write(" "+name+"Create(");
- param(writer, "resource", name, false, false);
- writer.write(") : "+name+"Creation\r\n");
+ param(writer, "resource", name+"Input", false, false);
+ writer.write("): "+name+"Creation\r\n");
writer.write("}\r\n");
writer.write("\r\n");
writer.write("type "+name+"Creation {\r\n");
- writer.write(" location : String\r\n");
- writer.write(" resource : "+name+"\r\n");
- writer.write(" information : OperationOutcome\r\n");
+ writer.write(" location: String\r\n");
+ writer.write(" resource: "+name+"\r\n");
+ writer.write(" information: OperationOutcome\r\n");
writer.write("}\r\n");
writer.write("\r\n");
}
@@ -132,13 +132,14 @@ public class GraphQLSchemaGenerator {
writer.write("type "+name+"UpdateType {\r\n");
writer.write(" "+name+"Update(");
param(writer, "id", "ID", false, false);
- param(writer, "resource", name, false, false);
- writer.write(") : "+name+"Update\r\n");
+ writer.write(", ");
+ param(writer, "resource", name+"Input", false, false);
+ writer.write("): "+name+"Update\r\n");
writer.write("}\r\n");
writer.write("\r\n");
writer.write("type "+name+"Update {\r\n");
- writer.write(" resource : "+name+"\r\n");
- writer.write(" information : OperationOutcome\r\n");
+ writer.write(" resource: "+name+"\r\n");
+ writer.write(" information: OperationOutcome\r\n");
writer.write("}\r\n");
writer.write("\r\n");
}
@@ -147,11 +148,11 @@ public class GraphQLSchemaGenerator {
writer.write("type "+name+"DeleteType {\r\n");
writer.write(" "+name+"Delete(");
param(writer, "id", "ID", false, false);
- writer.write(") : "+name+"Delete\r\n");
+ writer.write("): "+name+"Delete\r\n");
writer.write("}\r\n");
writer.write("\r\n");
writer.write("type "+name+"Delete {\r\n");
- writer.write(" information : OperationOutcome\r\n");
+ writer.write(" information: OperationOutcome\r\n");
writer.write("}\r\n");
writer.write("\r\n");
}
@@ -165,7 +166,7 @@ public class GraphQLSchemaGenerator {
param(writer, "_sort", "String", false, true);
param(writer, "_count", "Int", false, true);
param(writer, "_cursor", "String", false, true);
- writer.write(") : ["+name+"]\r\n");
+ writer.write("): ["+name+"]\r\n");
writer.write("}\r\n");
writer.write("\r\n");
}
@@ -174,7 +175,7 @@ public class GraphQLSchemaGenerator {
if (line)
writer.write("\r\n ");
writer.write(name);
- writer.write(" : ");
+ writer.write(": ");
if (list)
writer.write("[");
writer.write(type);
@@ -191,24 +192,24 @@ public class GraphQLSchemaGenerator {
param(writer, "_sort", "String", false, true);
param(writer, "_count", "Int", false, true);
param(writer, "_cursor", "String", false, true);
- writer.write(") : "+name+"Connection\r\n");
+ writer.write("): "+name+"Connection\r\n");
writer.write("}\r\n");
writer.write("\r\n");
writer.write("type "+name+"Connection {\r\n");
- writer.write(" count : Int\r\n");
- writer.write(" offset : Int\r\n");
- writer.write(" pagesize : Int\r\n");
- writer.write(" first : ID\r\n");
- writer.write(" previous : ID\r\n");
- writer.write(" next : ID\r\n");
- writer.write(" last : ID\r\n");
- writer.write(" edges : ["+name+"Edge]\r\n");
+ writer.write(" count: Int\r\n");
+ writer.write(" offset: Int\r\n");
+ writer.write(" pagesize: Int\r\n");
+ writer.write(" first: ID\r\n");
+ writer.write(" previous: ID\r\n");
+ writer.write(" next: ID\r\n");
+ writer.write(" last: ID\r\n");
+ writer.write(" edges: ["+name+"Edge]\r\n");
writer.write("}\r\n");
writer.write("\r\n");
writer.write("type "+name+"Edge {\r\n");
- writer.write(" mode : String\r\n");
- writer.write(" score : Float\r\n");
- writer.write(" resource : "+name+"\r\n");
+ writer.write(" mode: String\r\n");
+ writer.write(" score: Float\r\n");
+ writer.write(" resource: "+name+"\r\n");
writer.write("}\r\n");
writer.write("\r\n");
}
@@ -216,15 +217,15 @@ public class GraphQLSchemaGenerator {
private void generateIdAccess(BufferedWriter writer, String name) throws IOException {
writer.write("type "+name+"ReadType {\r\n");
- writer.write(" "+name+"(id : ID!) : "+name+"\r\n");
+ writer.write(" "+name+"(id: ID!): "+name+"\r\n");
writer.write("}\r\n");
writer.write("\r\n");
}
private void generateElementBase(BufferedWriter writer) throws IOException {
writer.write("type ElementBase {\r\n");
- writer.write(" id : ID\r\n");
- writer.write(" extension : [Extension]{\r\n");
+ writer.write(" id: ID\r\n");
+ writer.write(" extension: [Extension]\r\n");
writer.write("}\r\n");
writer.write("\r\n");
@@ -241,7 +242,7 @@ public class GraphQLSchemaGenerator {
b.append(sd.getName());
b.append(" {\r\n");
ElementDefinition ed = sd.getSnapshot().getElementFirstRep();
- generateProperties(list, b, sd.getName(), sd, ed, "type");
+ generateProperties(list, b, sd.getName(), sd, ed, "type", "");
b.append("}");
b.append("\r\n");
b.append("\r\n");
@@ -252,9 +253,9 @@ public class GraphQLSchemaGenerator {
list.add(b);
b.append("input ");
b.append(sd.getName());
- b.append(" {\r\n");
+ b.append("Input {\r\n");
ed = sd.getSnapshot().getElementFirstRep();
- generateProperties(list, b, sd.getName(), sd, ed, "input");
+ generateProperties(list, b, sd.getName(), sd, ed, "input", "Input");
b.append("}");
b.append("\r\n");
b.append("\r\n");
@@ -262,22 +263,22 @@ public class GraphQLSchemaGenerator {
writer.write(bs.toString());
}
- private void generateProperties(List list, StringBuilder b, String typeName, StructureDefinition sd, ElementDefinition ed, String mode) throws IOException {
+ private void generateProperties(List list, StringBuilder b, String typeName, StructureDefinition sd, ElementDefinition ed, String mode, String suffix) throws IOException {
List children = ProfileUtilities.getChildList(sd, ed);
for (ElementDefinition child : children) {
if (child.hasContentReference()) {
ElementDefinition ref = resolveContentReference(sd, child.getContentReference());
- generateProperty(list, b, typeName, sd, child, ref.getType().get(0), false, ref, mode);
+ generateProperty(list, b, typeName, sd, child, ref.getType().get(0), false, ref, mode, suffix);
} else if (child.getType().size() == 1) {
- generateProperty(list, b, typeName, sd, child, child.getType().get(0), false, null, mode);
+ generateProperty(list, b, typeName, sd, child, child.getType().get(0), false, null, mode, suffix);
} else {
boolean ref = false;
for (TypeRefComponent t : child.getType()) {
if (!t.hasTarget())
- generateProperty(list, b, typeName, sd, child, t, true, null, mode);
+ generateProperty(list, b, typeName, sd, child, t, true, null, mode, suffix);
else if (!ref) {
ref = true;
- generateProperty(list, b, typeName, sd, child, t, true, null, mode);
+ generateProperty(list, b, typeName, sd, child, t, true, null, mode, suffix);
}
}
}
@@ -293,7 +294,7 @@ public class GraphQLSchemaGenerator {
throw new Error("Unable to find "+id);
}
- private void generateProperty(List list, StringBuilder b, String typeName, StructureDefinition sd, ElementDefinition child, TypeRefComponent typeDetails, boolean suffix, ElementDefinition cr, String mode) throws IOException {
+ private void generateProperty(List list, StringBuilder b, String typeName, StructureDefinition sd, ElementDefinition child, TypeRefComponent typeDetails, boolean suffix, ElementDefinition cr, String mode, String suffixS) throws IOException {
if (isPrimitive(typeDetails)) {
String n = getGqlname(typeDetails.getCode());
b.append(" ");
@@ -323,11 +324,11 @@ public class GraphQLSchemaGenerator {
b.append("[");
String type = typeDetails.getCode();
if (cr != null)
- b.append(generateInnerType(list, sd, typeName, cr, mode));
+ b.append(generateInnerType(list, sd, typeName, cr, mode, suffixS));
else if (Utilities.existsInList(type, "Element", "BackboneElement"))
- b.append(generateInnerType(list, sd, typeName, child, mode));
+ b.append(generateInnerType(list, sd, typeName, child, mode, suffixS));
else
- b.append(type);
+ b.append(type+suffixS);
if (!child.getMax().equals("1"))
b.append("]");
if (child.getMin() != 0 && !suffix)
@@ -336,7 +337,7 @@ public class GraphQLSchemaGenerator {
}
}
- private String generateInnerType(List list, StructureDefinition sd, String name, ElementDefinition child, String mode) throws IOException {
+ private String generateInnerType(List list, StructureDefinition sd, String name, ElementDefinition child, String mode, String suffix) throws IOException {
if (child.hasUserData(INNER_TYPE_NAME+"."+mode))
return child.getUserString(INNER_TYPE_NAME+"."+mode);
@@ -347,12 +348,13 @@ public class GraphQLSchemaGenerator {
b.append(mode);
b.append(" ");
b.append(typeName);
+ b.append(suffix);
b.append(" {\r\n");
- generateProperties(list, b, typeName, sd, child, mode);
+ generateProperties(list, b, typeName, sd, child, mode, suffix);
b.append("}");
b.append("\r\n");
b.append("\r\n");
- return typeName;
+ return typeName+suffix;
}
private String tail(String path, boolean suffix) {
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/formats/JsonTrackingParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/formats/JsonTrackingParser.java
index 5e3d1c3fe..7efc2986f 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/formats/JsonTrackingParser.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/formats/JsonTrackingParser.java
@@ -1,5 +1,7 @@
package org.hl7.fhir.r5.utils.formats;
+import java.io.File;
+
/*-
* #%L
* org.hl7.fhir.r5
@@ -22,10 +24,12 @@ package org.hl7.fhir.r5.utils.formats;
import java.io.IOException;
+import java.io.InputStream;
import java.math.BigDecimal;
import java.util.Map;
import java.util.Stack;
+import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import com.google.gson.JsonArray;
@@ -333,6 +337,26 @@ public class JsonTrackingParser {
private String itemName;
private String itemValue;
+ public static JsonObject parseJson(String source) throws IOException {
+ return parse(source, null);
+ }
+
+ public static JsonObject parseJson(InputStream stream) throws IOException {
+ return parse(TextFile.streamToString(stream), null);
+ }
+
+ public static JsonObject parseJson(byte[] stream) throws IOException {
+ return parse(TextFile.bytesToString(stream), null);
+ }
+
+ public static JsonObject parseJson(File source) throws IOException {
+ return parse(TextFile.fileToString(source), null);
+ }
+
+ public static JsonObject parseJsonFile(String source) throws IOException {
+ return parse(TextFile.fileToString(source), null);
+ }
+
public static JsonObject parse(String source, Map map) throws IOException {
JsonTrackingParser self = new JsonTrackingParser();
self.map = map;
@@ -404,7 +428,8 @@ public class JsonTrackingParser {
loc = lexer.location.copy();
obj.add(itemName, arr);
next();
- readArray(arr, false);
+ if (!readArray(arr, false))
+ next(true);
if (map != null)
map.put(arr, loc);
break;
@@ -418,8 +443,10 @@ public class JsonTrackingParser {
}
}
- private void readArray(JsonArray arr, boolean root) throws IOException {
+ private boolean readArray(JsonArray arr, boolean root) throws IOException {
+ boolean res = false;
while (!((itemType == ItemType.End) || (root && (itemType == ItemType.Eof)))) {
+ res = true;
switch (itemType) {
case Object:
JsonObject obj = new JsonObject(); // (arr.path+'['+inttostr(i)+']');
@@ -466,9 +493,14 @@ public class JsonTrackingParser {
}
next();
}
+ return res;
}
- private void next() throws IOException {
+ private void next() throws IOException {
+ next(false);
+ }
+
+ private void next(boolean noPop) throws IOException {
switch (itemType) {
case Object :
lexer.consume(TokenType.Open);
@@ -484,7 +516,7 @@ public class JsonTrackingParser {
case Number:
case End:
case Boolean :
- if (itemType == ItemType.End)
+ if (itemType == ItemType.End && !noPop)
lexer.states.pop();
if (lexer.getType() == TokenType.Comma) {
lexer.next();
diff --git a/org.hl7.fhir.utilities/pom.xml b/org.hl7.fhir.utilities/pom.xml
index 495f1259a..2faca0013 100644
--- a/org.hl7.fhir.utilities/pom.xml
+++ b/org.hl7.fhir.utilities/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.validation.cli/pom.xml b/org.hl7.fhir.validation.cli/pom.xml
index 81e039230..7293f6646 100644
--- a/org.hl7.fhir.validation.cli/pom.xml
+++ b/org.hl7.fhir.validation.cli/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml
index 3cae0b7b9..c920d62d4 100644
--- a/org.hl7.fhir.validation/pom.xml
+++ b/org.hl7.fhir.validation/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
org.hl7.fhir.core
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
../pom.xml
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java
index d74115fdd..b1624d690 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java
@@ -151,7 +151,6 @@ import ca.uhn.fhir.util.ObjectUtil;
public class InstanceValidator extends BaseValidator implements IResourceValidator {
-
private class ValidatorHostContext {
private Object appContext;
private Element container; // bundle, or parameters
diff --git a/pom.xml b/pom.xml
index 0fcf798d6..3e034df54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
each other. It is fine to bump the point version of this POM without affecting
HAPI FHIR.
-->
- 3.7.20-SNAPSHOT
+ 3.7.21-SNAPSHOT
3.7.0-SNAPSHOT
diff --git a/release.bat b/release.bat
index ae7a97267..ef375d8f1 100644
--- a/release.bat
+++ b/release.bat
@@ -4,11 +4,11 @@ REM make sure you are committed
echo
echo ===============================================================
-echo upgrade and release fhir.core from 3.7.19-SNAPSHOT to 3.7.20-SNAPSHOT
+echo upgrade and release fhir.core from 3.7.20-SNAPSHOT to 3.7.21-SNAPSHOT
echo ===============================================================
pause
-call mvn versions:set -DnewVersion=3.7.20-SNAPSHOT
+call mvn versions:set -DnewVersion=3.7.21-SNAPSHOT
echo ===============================================================
echo upgraded version number using maven
@@ -25,8 +25,8 @@ echo next: replace references in java code + ivy
echo ===============================================================
pause
-call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.java" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find "3.7.19-SNAPSHOT" --replace "3.7.20-SNAPSHOT"
-call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.xml" --excludeFileMask "*.dll, *.exe" --find "3.7.19-SNAPSHOT" --replace "3.7.20-SNAPSHOT"
+call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.java" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find "3.7.20-SNAPSHOT" --replace "3.7.21-SNAPSHOT"
+call "C:\tools\fnr.exe" --cl --dir "C:\work\org.hl7.fhir\build" --fileMask "*.xml" --excludeFileMask "*.dll, *.exe" --find "3.7.20-SNAPSHOT" --replace "3.7.21-SNAPSHOT"
echo ===============================================================
echo done replacing references