Merge pull request #1764 from hapifhir/FixElideIssue

Fix for issue identified in
This commit is contained in:
Grahame Grieve 2024-10-06 17:54:35 +08:00 committed by GitHub
commit 001b132231
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -833,6 +833,21 @@ public class JsonParser extends ParserBase {
} else if (!done.contains(child.getName())) {
done.add(child.getName());
List<Element> list = e.getChildrenByName(child.getName());
boolean skipList = false;
if (json.canElide() && isElideElements()) {
boolean foundNonElide = false;
for (Element listElement: list) {
if (!listElement.isElided()) {
foundNonElide = true;
break;
}
}
if (!foundNonElide) {
json.elide();
skipList = true;
}
}
if (!skipList) {
if (child.getProperty().getDefinition().hasExtension(ToolingExtensions.EXT_JSON_PROP_KEY))
composeKeyList(path, list);
else
@ -840,6 +855,7 @@ public class JsonParser extends ParserBase {
}
}
}
}
private void composeKeyList(String path, List<Element> list) throws IOException {
String keyName = list.get(0).getProperty().getDefinition().getExtensionString(ToolingExtensions.EXT_JSON_PROP_KEY);