From 07288ff21bbbf2af7b058af7202abfa36e8c4fcf Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 02:23:51 +0100 Subject: [PATCH 01/16] flattenDataObjectsFromJson WIP --- api/src/main/scala/dx/api/DxApi.scala | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index 89c35d5..2f203b0 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -245,6 +245,26 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default dataObject(objectId, projectId.map(project)) } + def flattenDataObjectsFromJson(jsValue: JsValue): Vector[DxDataObject] = { + try { + dataObject = dataObjectFromJson(jsValue) + Vector(dataObject) + } catch { + jsValue match { + case obj: JsObject => { + // TODO recurse - for object + } + case arr: JsArray => { + // TODO recurse - for array + } + case _ => { + // Not an object, array, or recognized dx data object + Vector.empty + } + } + } + } + def isDataObjectId(id: String): Boolean = { try { dataObject(id) From d7b968227e0c9b18b157d09fcfbd0f57b40569fe Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 02:30:16 +0100 Subject: [PATCH 02/16] recurse for array --- api/src/main/scala/dx/api/DxApi.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index 2f203b0..14725ae 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -247,15 +247,16 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default def flattenDataObjectsFromJson(jsValue: JsValue): Vector[DxDataObject] = { try { - dataObject = dataObjectFromJson(jsValue) - Vector(dataObject) + obj = dataObjectFromJson(jsValue) + Vector(obj) } catch { jsValue match { case obj: JsObject => { // TODO recurse - for object + Vector.empty } case arr: JsArray => { - // TODO recurse - for array + arr.elements.flatMap(flattenDataObjectsFromJson) } case _ => { // Not an object, array, or recognized dx data object From 353b9ba4c2d00ea679e146638538fc9368267f81 Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 12:38:14 +0100 Subject: [PATCH 03/16] fixing compilation errors --- api/src/main/scala/dx/api/DxApi.scala | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index 14725ae..f168ff0 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -247,22 +247,25 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default def flattenDataObjectsFromJson(jsValue: JsValue): Vector[DxDataObject] = { try { - obj = dataObjectFromJson(jsValue) + val obj = dataObjectFromJson(jsValue) Vector(obj) } catch { - jsValue match { - case obj: JsObject => { - // TODO recurse - for object - Vector.empty - } - case arr: JsArray => { - arr.elements.flatMap(flattenDataObjectsFromJson) - } - case _ => { - // Not an object, array, or recognized dx data object - Vector.empty - } + case _: Throwable => { + Vector.empty } + // jsValue match { + // case obj: JsObject => { + // // TODO recurse - for object + // Vector.empty + // } + // case arr: JsArray => { + // Vector(arr.elements).flatMap(flattenDataObjectsFromJson) + // } + // case _ => { + // // Not an object, array, or recognized dx data object + // Vector.empty + // } + // } } } From eb1f04702499e1de946d4c374dadcbb057638505 Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 12:40:27 +0100 Subject: [PATCH 04/16] fixing compilation errors --- api/src/main/scala/dx/api/DxApi.scala | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index f168ff0..17a5112 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -251,21 +251,21 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default Vector(obj) } catch { case _: Throwable => { - Vector.empty + jsValue match { + case obj: JsObject => { + // TODO recurse - for object + Vector.empty + } + case arr: JsArray => { + // Vector(arr.elements).flatMap(flattenDataObjectsFromJson) + Vector.empty + } + case _ => { + // Not an object, array, or recognized dx data object + Vector.empty + } + } } - // jsValue match { - // case obj: JsObject => { - // // TODO recurse - for object - // Vector.empty - // } - // case arr: JsArray => { - // Vector(arr.elements).flatMap(flattenDataObjectsFromJson) - // } - // case _ => { - // // Not an object, array, or recognized dx data object - // Vector.empty - // } - // } } } From da6aec66e421b28c20f8f0a66b682acf358730df Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 12:48:38 +0100 Subject: [PATCH 05/16] recursion for array --- api/src/main/scala/dx/api/DxApi.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index 17a5112..e335f2a 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -256,9 +256,8 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default // TODO recurse - for object Vector.empty } - case arr: JsArray => { - // Vector(arr.elements).flatMap(flattenDataObjectsFromJson) - Vector.empty + case JsArray(elements) => { + elements.flatMap(flattenDataObjectsFromJson) } case _ => { // Not an object, array, or recognized dx data object From e8a2cdec94433fb74ded2c3646a131f439efdc7c Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 12:54:55 +0100 Subject: [PATCH 06/16] recursion for object --- api/src/main/scala/dx/api/DxApi.scala | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index e335f2a..7c88899 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -252,17 +252,13 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } catch { case _: Throwable => { jsValue match { - case obj: JsObject => { - // TODO recurse - for object - Vector.empty - } - case JsArray(elements) => { + case JsObject(fields) => + fields.values.toVector.flatMap(flattenDataObjectsFromJson) + case JsArray(elements) => elements.flatMap(flattenDataObjectsFromJson) - } - case _ => { + case _ => // Not an object, array, or recognized dx data object Vector.empty - } } } } From d2f045987fab9fe5f03b79f593b9e73241814c87 Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 13:03:26 +0100 Subject: [PATCH 07/16] developers list --- build.sbt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 010df80..12080e9 100644 --- a/build.sbt +++ b/build.sbt @@ -10,16 +10,9 @@ name := "dxScala" ThisBuild / organization := "com.dnanexus" ThisBuild / scalaVersion := "2.13.7" ThisBuild / developers := List( - Developer("commandlinegirl", - "Ola Zalcman", - "azalcman@dnanexus.com", - url("https://github.com/dnanexus")), Developer("Gvaihir", "Gvaihir", "aogrodnikov@dnanexus.com", url("https://github.com/dnanexus")), Developer("mhrvol", "Marek Hrvol", "mhrvol@dnanexus.com", url("https://github.com/dnanexus")), - Developer("r-i-v-a", - "Riva Nathans", - "rnathans@dnanexus.com", - url("https://github.com/dnanexus")), + Developer("r-i-v-a", "Riva Kepych", "rkepych@dnanexus.com", url("https://github.com/dnanexus")), Developer("YuxinShi0423", "Yuxin Shi", "yshi@dnanexus.com", url("https://github.com/dnanexus")), ) ThisBuild / homepage := Some(url("https://github.com/dnanexus/dxScala")) From 3367650d700624409354487dc72618fc56cee4bc Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 13:34:37 +0100 Subject: [PATCH 08/16] flattenDxFileObjectsFromJson --- api/src/main/scala/dx/api/DxApi.scala | 44 +++++++++++++++------------ 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index 7c88899..eae4577 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -214,6 +214,31 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } } + def flattenDataObjectsFromJson(jsValue: JsValue): Vector[DxDataObject] = { + try { + val obj = dataObjectFromJson(jsValue) + Vector(obj) + } catch { + case _: Throwable => { + jsValue match { + case JsObject(fields) => + fields.values.toVector.flatMap(flattenDataObjectsFromJson) + case JsArray(elements) => + elements.flatMap(flattenDataObjectsFromJson) + case _ => + // Not an object, array, or recognized dx data object + Vector.empty + } + } + } + } + + def flattenDxFileObjectsFromJson(jsValue: JsValue): Vector[DxFile] = { + flattenDataObjectsFromJson(jsValue).collect { + case obj: DxFile => obj + } + } + def dataObjectFromJson(jsValue: JsValue): DxDataObject = { val link = jsValue match { case JsObject(fields) if fields.contains(DxUtils.DxLinkKey) => @@ -245,25 +270,6 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default dataObject(objectId, projectId.map(project)) } - def flattenDataObjectsFromJson(jsValue: JsValue): Vector[DxDataObject] = { - try { - val obj = dataObjectFromJson(jsValue) - Vector(obj) - } catch { - case _: Throwable => { - jsValue match { - case JsObject(fields) => - fields.values.toVector.flatMap(flattenDataObjectsFromJson) - case JsArray(elements) => - elements.flatMap(flattenDataObjectsFromJson) - case _ => - // Not an object, array, or recognized dx data object - Vector.empty - } - } - } - } - def isDataObjectId(id: String): Boolean = { try { dataObject(id) From e68a639c1db090b68a078aad265854f6ca3f6043 Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 18:37:19 +0100 Subject: [PATCH 09/16] Move bulk describe logging here and make it consistent (after ids --> set, so the numbers should match) --- api/src/main/scala/dx/api/DxApi.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index eae4577..7fdcf2e 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -980,9 +980,12 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default (Vector.empty, files) } + val uniqueFileIds = files.map(_.id).toSet + logger.trace(s"Bulk describing ${uniqueFileIds} unique file ids") + val allResults = workspaceResults ++ remaining.groupBy(_.project).flatMap { case (None, files) if currentProjectId.isDefined => - submitRequest(files.map(_.id).toSet, currentProject) + submitRequest(uniqueFileIds, currentProject) case (None, files) => throw new Exception( s""" @@ -991,9 +994,9 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default |""".stripMargin ) case (proj, files) if proj.get.id.startsWith("container") && proj != currentWorkspace => - submitRequest(files.map(_.id).toSet, currentProject) + submitRequest(uniqueFileIds, currentProject) case (proj, files) => - submitRequest(files.map(_.id).toSet, proj) + submitRequest(uniqueFileIds, proj) } if (validate) { @@ -1015,6 +1018,7 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } } + logger.trace(s"Successfully bulk described ${allResults.size} files") allResults } From d57efcb4c982e90bac97315e1830cefe8579a252 Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 18:49:40 +0100 Subject: [PATCH 10/16] Logging - uniqueFileIds.size --- api/src/main/scala/dx/api/DxApi.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index 7fdcf2e..8c9f241 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -981,7 +981,7 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } val uniqueFileIds = files.map(_.id).toSet - logger.trace(s"Bulk describing ${uniqueFileIds} unique file ids") + logger.trace(s"Bulk describing ${uniqueFileIds.size} unique file ids") val allResults = workspaceResults ++ remaining.groupBy(_.project).flatMap { case (None, files) if currentProjectId.isDefined => From 4d8e9c9d674fea9e6dca8e7ac8c651b6976981ca Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 19:01:34 +0100 Subject: [PATCH 11/16] Revert "Logging - uniqueFileIds.size" This reverts commit d57efcb4c982e90bac97315e1830cefe8579a252. --- api/src/main/scala/dx/api/DxApi.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index 8c9f241..7fdcf2e 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -981,7 +981,7 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } val uniqueFileIds = files.map(_.id).toSet - logger.trace(s"Bulk describing ${uniqueFileIds.size} unique file ids") + logger.trace(s"Bulk describing ${uniqueFileIds} unique file ids") val allResults = workspaceResults ++ remaining.groupBy(_.project).flatMap { case (None, files) if currentProjectId.isDefined => From b9b2a06e918f960869e4e410f1263c48b8ee34a8 Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 19:01:50 +0100 Subject: [PATCH 12/16] Revert "Move bulk describe logging here and make it consistent (after ids --> set, so the numbers should match)" This reverts commit e68a639c1db090b68a078aad265854f6ca3f6043. --- api/src/main/scala/dx/api/DxApi.scala | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index 7fdcf2e..eae4577 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -980,12 +980,9 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default (Vector.empty, files) } - val uniqueFileIds = files.map(_.id).toSet - logger.trace(s"Bulk describing ${uniqueFileIds} unique file ids") - val allResults = workspaceResults ++ remaining.groupBy(_.project).flatMap { case (None, files) if currentProjectId.isDefined => - submitRequest(uniqueFileIds, currentProject) + submitRequest(files.map(_.id).toSet, currentProject) case (None, files) => throw new Exception( s""" @@ -994,9 +991,9 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default |""".stripMargin ) case (proj, files) if proj.get.id.startsWith("container") && proj != currentWorkspace => - submitRequest(uniqueFileIds, currentProject) + submitRequest(files.map(_.id).toSet, currentProject) case (proj, files) => - submitRequest(uniqueFileIds, proj) + submitRequest(files.map(_.id).toSet, proj) } if (validate) { @@ -1018,7 +1015,6 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } } - logger.trace(s"Successfully bulk described ${allResults.size} files") allResults } From 3991d38bae55b3fcc99cf587ad2687acbd68298f Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Thu, 21 Mar 2024 19:05:48 +0100 Subject: [PATCH 13/16] Add logging back --- api/src/main/scala/dx/api/DxApi.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index eae4577..e0851dd 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -951,6 +951,7 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default // to limit the number of objects in one API request. DxFindDataObjects // caches the desc on the DxFile object, so we only need to return the DxFile. def submitRequest(ids: Set[String], project: Option[DxProject]): Vector[DxFile] = { + logger.trace(s"Bulk describing ${ids.size} unique file ids") ids .grouped(limit) .flatMap { chunk => @@ -1015,6 +1016,7 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } } + logger.trace(s"Successfully bulk described ${allResults.size} files") allResults } From 667f82cc67b037e30f5810b76c5b262c9b6559bc Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Fri, 22 Mar 2024 00:25:05 +0100 Subject: [PATCH 14/16] naming; tests WIP --- api/src/main/scala/dx/api/DxApi.scala | 8 ++-- api/src/test/scala/dx/api/DxApiTest.scala | 47 +++++++++++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/api/src/main/scala/dx/api/DxApi.scala b/api/src/main/scala/dx/api/DxApi.scala index e0851dd..3d8cde8 100644 --- a/api/src/main/scala/dx/api/DxApi.scala +++ b/api/src/main/scala/dx/api/DxApi.scala @@ -214,7 +214,7 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } } - def flattenDataObjectsFromJson(jsValue: JsValue): Vector[DxDataObject] = { + def flattenDxDataObjectsFromJson(jsValue: JsValue): Vector[DxDataObject] = { try { val obj = dataObjectFromJson(jsValue) Vector(obj) @@ -222,9 +222,9 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default case _: Throwable => { jsValue match { case JsObject(fields) => - fields.values.toVector.flatMap(flattenDataObjectsFromJson) + fields.values.toVector.flatMap(flattenDxDataObjectsFromJson) case JsArray(elements) => - elements.flatMap(flattenDataObjectsFromJson) + elements.flatMap(flattenDxDataObjectsFromJson) case _ => // Not an object, array, or recognized dx data object Vector.empty @@ -234,7 +234,7 @@ case class DxApi(version: String = "1.0.0", dxEnv: DXEnvironment = DxApi.default } def flattenDxFileObjectsFromJson(jsValue: JsValue): Vector[DxFile] = { - flattenDataObjectsFromJson(jsValue).collect { + flattenDxDataObjectsFromJson(jsValue).collect { case obj: DxFile => obj } } diff --git a/api/src/test/scala/dx/api/DxApiTest.scala b/api/src/test/scala/dx/api/DxApiTest.scala index d92f398..8e3da2e 100644 --- a/api/src/test/scala/dx/api/DxApiTest.scala +++ b/api/src/test/scala/dx/api/DxApiTest.scala @@ -251,4 +251,51 @@ class DxApiTest extends AnyFlatSpec with Matchers with BeforeAndAfterAll with Mo app.describe().name shouldBe "bam_to_fastq" app.describe().version shouldBe "1.0.0" } + + it should "flatten collect files from JSON - nested array" { + // given + val jsNestedArrayWithFiles = { + val file1 = JsObject( + "$dnanexus_link" -> JsString("file-GgyF7P00q9pQGXZKkKBF5xpP") + ) + val file2 = JsObject( + "$dnanexus_link" -> JsString("file-GgyF7P00q9pyV2qbgYxk30J5") + ) + JsArray(Vector(JsArray(Vector(file1)), JsArray(Vector(file2)))) + } + + // when + val result = dxApi.flattenDxFileObjectsFromJson(jsNestedArrayWithFiles) + + // then + result.size shouldBe 2 + } + + it should "flatten collect files from JSON - nested object" { + // given + val jsNestedObjectWithDataObjects = { + val file1 = JsObject( + "$dnanexus_link" -> JsString("file-GgyF7P00q9pQGXZKkKBF5xpP") + ) + val file2 = JsObject( + "$dnanexus_link" -> JsString("file-GgyF7P00q9pyV2qbgYxk30J5") + ) + val record1 = JsObject( + "$dnanexus_link" -> JsString("record-Fgk7V7j0f9JfkYK55P7k3jGY") + ) + JsObject( + "a" -> file1, + "b" -> record1, + "c" -> JsObject( + "d" -> file2 + ) + ) + } + + // when + val result = dxApi.flattenDxFileObjectsFromJson(jsNestedArrayWithFiles) + + // then + result.size shouldBe 2 + } } From d5f67d9bf94bd7541699e87fd72a7371c99d4e92 Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Fri, 22 Mar 2024 00:38:49 +0100 Subject: [PATCH 15/16] unit tests - fix syntax --- api/src/test/scala/dx/api/DxApiTest.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/test/scala/dx/api/DxApiTest.scala b/api/src/test/scala/dx/api/DxApiTest.scala index 8e3da2e..692694a 100644 --- a/api/src/test/scala/dx/api/DxApiTest.scala +++ b/api/src/test/scala/dx/api/DxApiTest.scala @@ -252,7 +252,7 @@ class DxApiTest extends AnyFlatSpec with Matchers with BeforeAndAfterAll with Mo app.describe().version shouldBe "1.0.0" } - it should "flatten collect files from JSON - nested array" { + it should "flat collect files from JSON - nested array" in { // given val jsNestedArrayWithFiles = { val file1 = JsObject( @@ -271,7 +271,7 @@ class DxApiTest extends AnyFlatSpec with Matchers with BeforeAndAfterAll with Mo result.size shouldBe 2 } - it should "flatten collect files from JSON - nested object" { + it should "flat collect files from JSON - nested object" in { // given val jsNestedObjectWithDataObjects = { val file1 = JsObject( @@ -293,7 +293,7 @@ class DxApiTest extends AnyFlatSpec with Matchers with BeforeAndAfterAll with Mo } // when - val result = dxApi.flattenDxFileObjectsFromJson(jsNestedArrayWithFiles) + val result = dxApi.flattenDxFileObjectsFromJson(jsNestedObjectWithDataObjects) // then result.size shouldBe 2 From 4b5633628d0507de5e0f212069e60650afcfe6ae Mon Sep 17 00:00:00 2001 From: Riva Kepych Date: Fri, 22 Mar 2024 00:47:16 +0100 Subject: [PATCH 16/16] changelog --- api/RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/api/RELEASE_NOTES.md b/api/RELEASE_NOTES.md index b1e16d2..5bff78c 100644 --- a/api/RELEASE_NOTES.md +++ b/api/RELEASE_NOTES.md @@ -3,6 +3,7 @@ ## in develop * Change to make the user-agent string for dxScala more distinctive. +* Support for collecting data objects / files nested inside JSON objects. ## 0.13.9 (2024-02-29) * adds `headJobOnDemand` attribute to jobNew call