private JsonNode createLeafNodeIfNotExists(JsonNode root, JsonNode elementNode, String path) throws IOException {
        if (path == null || path.isBlank()) {
            return root;
        }
        JsonNode leafNode = jsonTreeOperations.read(root, path);
        if (leafNode == null) {
            leafNode = elementNode.isArray() ? jsonTreeOperations.arrayNode() : jsonTreeOperations.objectNode();
            root = jsonTreeOperations.put(root, JsonTreeUtil.getParentKey(path), JsonTreeUtil.getKey(path), leafNode);
        }
        return root;
    }
Prepares the parent node of the path if array => prepare the array node of
the path and => if indexed , prepares the respective index element => prepare
the object node of the path

@param root
@param paths
@param index
@return
@throws IOException
manifest-generator/generator-services/src/main/java/io/hyscale/generator/services/utils/ManifestTreeUtils.java