Skip to content

Commit f161c8f

Browse files
authored
Merge pull request #337 from holashchand/issue-975
[BUG]: Fixed attestation causing issues when using an array type property
2 parents e619da9 + 308d624 commit f161c8f

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

java/registry/src/main/java/dev/sunbirdrc/registry/dao/VertexReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ private ArrayNode expandChildObject(ObjectNode entityNode, List<String> processe
357357
if (expandChildObject.size() == 0 && entityNode.get(field).size() == 0) {
358358
entityNode.remove(field);
359359
}
360-
if (expandChildObject != null && expandChildObject.size() > 0) {
360+
if (expandChildObject != null && entityNode.get(field).size() == 1) {
361361
entityNode.set(field, expandChildObject);
362362
}
363363
}

java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.fasterxml.jackson.databind.ObjectMapper;
66
import com.fasterxml.jackson.databind.node.ArrayNode;
77
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
8+
import com.fasterxml.jackson.databind.node.JsonNodeType;
89
import com.fasterxml.jackson.databind.node.ObjectNode;
910
import com.jayway.jsonpath.DocumentContext;
1011
import com.jayway.jsonpath.JsonPath;
@@ -521,7 +522,7 @@ private void doUpdate(Shard shard, Graph graph, IRegistryDao registryDao, Vertex
521522
oneElementNode.isValueNode() || oneElementNode.isArray()) {
522523
logger.info("Value or array node, going to update {}", oneElement.getKey());
523524

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

0 commit comments

Comments
 (0)