Skip to content

Commit

Permalink
Fixed attestation causing issues when using an array type property
Browse files Browse the repository at this point in the history
  • Loading branch information
holashchand committed Jun 21, 2024
1 parent 9c09f34 commit 308d624
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private ArrayNode expandChildObject(ObjectNode entityNode, List<String> processe
if (expandChildObject.size() == 0 && entityNode.get(field).size() == 0) {
entityNode.remove(field);
}
if (expandChildObject != null && expandChildObject.size() > 0) {
if (expandChildObject != null && entityNode.get(field).size() == 1) {
entityNode.set(field, expandChildObject);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
Expand Down Expand Up @@ -517,7 +518,7 @@ private void doUpdate(Shard shard, Graph graph, IRegistryDao registryDao, Vertex
oneElementNode.isValueNode() || oneElementNode.isArray()) {
logger.info("Value or array node, going to update {}", oneElement.getKey());

if (oneElementNode.isArray()) {
if (oneElementNode.isArray() && (oneElementNode.isEmpty() || oneElementNode.get(0).getNodeType().equals(JsonNodeType.OBJECT))) {
// Arrays are treated specially - we create a blank node and then
// individual items
String arrayRefLabel = RefLabelHelper.getArrayLabel(oneElement.getKey(), uuidPropertyName);
Expand Down

0 comments on commit 308d624

Please sign in to comment.