From 08ac315f91bc83bcf24e53fa1d58058faab7428a Mon Sep 17 00:00:00 2001 From: "andrei.kislitsyn" Date: Wed, 14 May 2025 15:49:18 +0400 Subject: [PATCH 1/8] utilities generation topic --- docs/StardustDocs/d.tree | 1 + .../topics/Utilities-Generation.md | 223 ++++++++ .../notebook_test_generate_docs_1.html | 520 ++++++++++++++++++ tests/build.gradle.kts | 1 + .../kotlinx/dataframe/samples/api/Generate.kt | 166 ++++++ 5 files changed, 911 insertions(+) create mode 100644 docs/StardustDocs/topics/Utilities-Generation.md create mode 100644 docs/resources/api/generate_docs/notebook_test_generate_docs_1.html create mode 100644 tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Generate.kt diff --git a/docs/StardustDocs/d.tree b/docs/StardustDocs/d.tree index 6cd7f92400..3db96f109d 100644 --- a/docs/StardustDocs/d.tree +++ b/docs/StardustDocs/d.tree @@ -191,6 +191,7 @@ + diff --git a/docs/StardustDocs/topics/Utilities-Generation.md b/docs/StardustDocs/topics/Utilities-Generation.md new file mode 100644 index 0000000000..5b44d16172 --- /dev/null +++ b/docs/StardustDocs/topics/Utilities-Generation.md @@ -0,0 +1,223 @@ +# Utilities Generation + + +Generate useful Kotlin definitions based on your DataFrame structure. + + + +Generate useful Kotlin definitions based on your DataFrame structure. + + + +Generate useful Kotlin definitions based on your DataFrame structure. + + + + +Special utility functions that generate code of useful Kotlin definitions (returned as a `String`) +based on the current `DataFrame` schema. + + +## generateInterfaces + +Generates [`@DataSchema`](schemas.md) interfaces for this `DataFrame` +(including all nested `DataFrame` columns and column groups) as Kotlin interfaces. + +This is useful when working with the [compiler plugin](Compiler-Plugin.md) +in cases where the schema cannot be inferred automatically from the source. + +### Arguments {id="generateInterfaces-arguments"} +* `markerName`: `String` – The base name to use for generated interfaces. + If not specified, uses the `T` type argument of `DataFrame` simple name. + +### Returns {id="generateInterfaces-returns"} +* `CodeString` – A value class wrapper for `String`, containing + the generated Kotlin code of `@DataSchema` interfaces without extension properties. + +### Examples {id="generateInterfaces-examples"}} + + + + +```kotlin +df +``` + + + + + + + +```kotlin +df.generateInterfaces() +``` + + + +Output: +```kotlin +@DataSchema(isOpen = false) +interface _DataFrameType11 { + val amount: kotlin.Double + val orderId: kotlin.Int +} + +@DataSchema +interface _DataFrameType1 { + val orders: List<_DataFrameType11> + val user: kotlin.String +} +``` + +By adding these interfaces to your project with the [compiler plugin](Compiler-Plugin.md) enabled, +you'll gain full support for the [extension properties API](extensionPropertiesApi.md) and type-safe operations. + +Use [`cast`](cast.md) to apply the generated schema to a `DataFrame`: + + + +```kotlin +df.cast<_DataFrameType1>().filter { orders.all { orderId >= 102 } } +``` + + + + + +## generateDataClasses + +Generates Kotlin data classes corresponding to the `DataFrame` schema +(including all nested `DataFrame` columns and column groups). + +Useful when you want to: + +- Work with the data as regular Kotlin data classes. +- Work with data classes serialization. +- Extract structured types for further use in your application. +- +### Arguments {id="generateDataClasses-arguments"} +* `markerName`: `String?` — The base name to use for generated data classes. + If `null`, uses the `T` type argument of `DataFrame` simple name. + Default: `null`. +* `extensionProperties`: `Boolean` – Whether to generate extension properties in addition to `data class` declarations. + Default: `false`. +* `visibility`: `MarkerVisibility` – Visibility modifier for the generated declarations. + Default: `MarkerVisibility.IMPLICIT_PUBLIC`. +* `useFqNames`: `Boolean` – If `true`, fully qualified type names will be used in generated code. + Default: `false`. +* `nameNormalizer`: `NameNormalizer` – Strategy for converting column names (with spaces, underscores, etc.) to valid Kotlin identifiers. + Default: `NameNormalizer.default`. + +### Returns {id="generateDataClasses-returns"} +* `CodeString` – A value class wrapper for `String`, containing + the generated Kotlin code of `data class` declarations and optionally extension properties. + +### Examples {id="generateDataClasses-examples"} + + + +```kotlin +df.generateDataClasses("Customer") +``` + + + +Output: +```kotlin +@DataSchema +data class Customer1( + val amount: Double, + val orderId: Int +) + +@DataSchema +data class Customer( + val orders: List, + val user: String +) +``` + +AAdd these classes to your project and convert the DataFrame to a list of typed objects: + + + +```kotlin +val customers: List = df.cast().toList() +``` + + + + + +## generateCode + +Generates a data schema interface as [`generateInterfaces()`](#generateinterfaces), +along with explicit [extension properties](extensionPropertiesApi.md). +Useful if you don't use the [compiler plugin](Compiler-Plugin.md). + +### Arguments {id="generateCode-arguments"} +* `markerName`: `String` – The base name to use for generated interfaces. +If not specified, uses the `T` type argument of `DataFrame` simple name. +* `fields`: `Boolean` – Whether to generate fields (`val ...`) inside interfaces. +Default: `true`. +* `extensionProperties`: `Boolean` – Whether to generate extension properties for the schema. +Default: `true`. +* `visibility`: `MarkerVisibility` – Visibility modifier for the generated declarations. +Default: `MarkerVisibility.IMPLICIT_PUBLIC`. + +### Returns {id="generateCode-returns"} +* `CodeString` – A value class wrapper for `String`, containing +the generated Kotlin code of `@DataSchema` interfaces and/or extension properties. + +### Examples {id="generateCode-examples"} + +```kotlin +df.generateCode("Customer") +``` + + + +Output: +```kotlin +@DataSchema(isOpen = false) +interface Customer1 { + val amount: kotlin.Double + val orderId: kotlin.Int +} + +val org.jetbrains.kotlinx.dataframe.ColumnsContainer.amount: org.jetbrains.kotlinx.dataframe.DataColumn @JvmName("Customer1_amount") get() = this["amount"] as org.jetbrains.kotlinx.dataframe.DataColumn +val org.jetbrains.kotlinx.dataframe.DataRow.amount: kotlin.Double @JvmName("Customer1_amount") get() = this["amount"] as kotlin.Double +val org.jetbrains.kotlinx.dataframe.ColumnsContainer.orderId: org.jetbrains.kotlinx.dataframe.DataColumn @JvmName("Customer1_orderId") get() = this["orderId"] as org.jetbrains.kotlinx.dataframe.DataColumn +val org.jetbrains.kotlinx.dataframe.DataRow.orderId: kotlin.Int @JvmName("Customer1_orderId") get() = this["orderId"] as kotlin.Int + +@DataSchema +interface Customer { + val orders: List + val user: kotlin.String +} + +val org.jetbrains.kotlinx.dataframe.ColumnsContainer.orders: org.jetbrains.kotlinx.dataframe.DataColumn> @JvmName("Customer_orders") get() = this["orders"] as org.jetbrains.kotlinx.dataframe.DataColumn> +val org.jetbrains.kotlinx.dataframe.DataRow.orders: org.jetbrains.kotlinx.dataframe.DataFrame @JvmName("Customer_orders") get() = this["orders"] as org.jetbrains.kotlinx.dataframe.DataFrame +val org.jetbrains.kotlinx.dataframe.ColumnsContainer.user: org.jetbrains.kotlinx.dataframe.DataColumn @JvmName("Customer_user") get() = this["user"] as org.jetbrains.kotlinx.dataframe.DataColumn +val org.jetbrains.kotlinx.dataframe.DataRow.user: kotlin.String @JvmName("Customer_user") get() = this["user"] as kotlin.String +``` + +By adding this generated code to your project, you can use the [extension properties API](extensionPropertiesApi.md) +for fully type-safe column access and transformations. + +Use [`cast`](cast.md) to apply the generated schema to a `DataFrame`: + + + +```kotlin +df.cast() + .add("ordersTotal") { orders.sumOf { it.amount } } + .filter { user.startsWith("A") } + .rename { user }.into("customer") +``` + + + + + diff --git a/docs/resources/api/generate_docs/notebook_test_generate_docs_1.html b/docs/resources/api/generate_docs/notebook_test_generate_docs_1.html new file mode 100644 index 0000000000..3fd35bf310 --- /dev/null +++ b/docs/resources/api/generate_docs/notebook_test_generate_docs_1.html @@ -0,0 +1,520 @@ + + + + + +
+ +

+ + + diff --git a/tests/build.gradle.kts b/tests/build.gradle.kts index 99957219f3..b6e0a3adbf 100644 --- a/tests/build.gradle.kts +++ b/tests/build.gradle.kts @@ -60,6 +60,7 @@ kotlin.sourceSets { korro { docs = fileTree(rootProject.rootDir) { + include("docs/StardustDocs/topics/Utilities-Generation.md") include("docs/StardustDocs/topics/read.md") include("docs/StardustDocs/topics/write.md") include("docs/StardustDocs/topics/guides/*.md") diff --git a/tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Generate.kt b/tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Generate.kt new file mode 100644 index 0000000000..d02d2fa355 --- /dev/null +++ b/tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Generate.kt @@ -0,0 +1,166 @@ +@file:Suppress("UNUSED_VARIABLE", "unused", "UNCHECKED_CAST") +package org.jetbrains.kotlinx.dataframe.samples.api + +import org.jetbrains.kotlinx.dataframe.annotations.DataSchema +import org.jetbrains.kotlinx.dataframe.api.add +import org.jetbrains.kotlinx.dataframe.api.all +import org.jetbrains.kotlinx.dataframe.api.cast +import org.jetbrains.kotlinx.dataframe.api.dataFrameOf +import org.jetbrains.kotlinx.dataframe.api.filter +import org.jetbrains.kotlinx.dataframe.api.generateCode +import org.jetbrains.kotlinx.dataframe.api.generateDataClasses +import org.jetbrains.kotlinx.dataframe.api.generateInterfaces +import org.jetbrains.kotlinx.dataframe.api.into +import org.jetbrains.kotlinx.dataframe.api.rename +import org.jetbrains.kotlinx.dataframe.api.sumOf +import org.jetbrains.kotlinx.dataframe.api.toList +import org.jetbrains.kotlinx.kandy.letsplot.samples.SampleHelper +import org.junit.Test + +class Generate : SampleHelper("generate_docs", "api") { + val ordersAlice = dataFrameOf( + "orderId" to listOf(101, 102), + "amount" to listOf(50.0, 75.5) + ) + + val ordersBob = dataFrameOf( + "orderId" to listOf(103, 104, 105), + "amount" to listOf(20.0, 30.0, 25.0) + ) + + val df = dataFrameOf( + "user" to listOf("Alice", "Bob"), + "orders" to listOf(ordersAlice, ordersBob) + ) + + @DataSchema(isOpen = false) + interface _DataFrameType11 { + val amount: kotlin.Double + val orderId: kotlin.Int + } + + val org.jetbrains.kotlinx.dataframe.ColumnsContainer<_DataFrameType11>.amount: org.jetbrains.kotlinx.dataframe.DataColumn + @JvmName( + "_DataFrameType11_amount" + ) get() = this["amount"] as org.jetbrains.kotlinx.dataframe.DataColumn + val org.jetbrains.kotlinx.dataframe.DataRow<_DataFrameType11>.amount: kotlin.Double @JvmName("_DataFrameType11_amount") get() = this["amount"] as kotlin.Double + val org.jetbrains.kotlinx.dataframe.ColumnsContainer<_DataFrameType11>.orderId: org.jetbrains.kotlinx.dataframe.DataColumn + @JvmName( + "_DataFrameType11_orderId" + ) get() = this["orderId"] as org.jetbrains.kotlinx.dataframe.DataColumn + val org.jetbrains.kotlinx.dataframe.DataRow<_DataFrameType11>.orderId: kotlin.Int @JvmName("_DataFrameType11_orderId") get() = this["orderId"] as kotlin.Int + + @DataSchema + interface _DataFrameType1 { + val orders: List<_DataFrameType11> + val user: kotlin.String + } + + val org.jetbrains.kotlinx.dataframe.ColumnsContainer<_DataFrameType1>.orders: org.jetbrains.kotlinx.dataframe.DataColumn> + @JvmName( + "_DataFrameType1_orders" + ) get() = this["orders"] as org.jetbrains.kotlinx.dataframe.DataColumn> + val org.jetbrains.kotlinx.dataframe.DataRow<_DataFrameType1>.orders: org.jetbrains.kotlinx.dataframe.DataFrame<_DataFrameType11> + @JvmName( + "_DataFrameType1_orders" + ) get() = this["orders"] as org.jetbrains.kotlinx.dataframe.DataFrame<_DataFrameType11> + val org.jetbrains.kotlinx.dataframe.ColumnsContainer<_DataFrameType1>.user: org.jetbrains.kotlinx.dataframe.DataColumn + @JvmName( + "_DataFrameType1_user" + ) get() = this["user"] as org.jetbrains.kotlinx.dataframe.DataColumn + val org.jetbrains.kotlinx.dataframe.DataRow<_DataFrameType1>.user: kotlin.String @JvmName("_DataFrameType1_user") get() = this["user"] as kotlin.String + + @DataSchema + data class Customer1( + val amount: Double, + val orderId: Int + ) + + @DataSchema + data class Customer( + val orders: List, + val user: String + ) + + val org.jetbrains.kotlinx.dataframe.ColumnsContainer.amount: org.jetbrains.kotlinx.dataframe.DataColumn + @JvmName( + "Customer1_amount" + ) get() = this["amount"] as org.jetbrains.kotlinx.dataframe.DataColumn + val org.jetbrains.kotlinx.dataframe.DataRow.amount: kotlin.Double @JvmName("Customer1_amount") get() = this["amount"] as kotlin.Double + val org.jetbrains.kotlinx.dataframe.ColumnsContainer.orderId: org.jetbrains.kotlinx.dataframe.DataColumn + @JvmName( + "Customer1_orderId" + ) get() = this["orderId"] as org.jetbrains.kotlinx.dataframe.DataColumn + val org.jetbrains.kotlinx.dataframe.DataRow.orderId: kotlin.Int @JvmName("Customer1_orderId") get() = this["orderId"] as kotlin.Int + + val org.jetbrains.kotlinx.dataframe.ColumnsContainer.orders: org.jetbrains.kotlinx.dataframe.DataColumn> + @JvmName( + "Customer_orders" + ) get() = this["orders"] as org.jetbrains.kotlinx.dataframe.DataColumn> + val org.jetbrains.kotlinx.dataframe.DataRow.orders: org.jetbrains.kotlinx.dataframe.DataFrame + @JvmName( + "Customer_orders" + ) get() = this["orders"] as org.jetbrains.kotlinx.dataframe.DataFrame + val org.jetbrains.kotlinx.dataframe.ColumnsContainer.user: org.jetbrains.kotlinx.dataframe.DataColumn + @JvmName( + "Customer_user" + ) get() = this["user"] as org.jetbrains.kotlinx.dataframe.DataColumn + val org.jetbrains.kotlinx.dataframe.DataRow.user: kotlin.String @JvmName("Customer_user") get() = this["user"] as kotlin.String + + private val customers: List = df.cast().toList() + + @Test + fun notebook_test_generate_docs_1() { + // SampleStart + df + // SampleEnd + .saveDfHtmlSample() + } + + @Test + fun notebook_test_generate_docs_2() { + // SampleStart + df.generateInterfaces() + // SampleEnd + } + + @Test + fun notebook_test_generate_docs_3() { + // SampleStart + df.cast<_DataFrameType1>().filter { orders.all { orderId >= 102 } } + // SampleEnd + //.saveDfHtmlSample() + } + + @Test + fun notebook_test_generate_docs_4() { + // SampleStart + df.generateDataClasses("Customer") + // SampleEnd + } + + @Test + fun notebook_test_generate_docs_5() { + // SampleStart + val customers: List = df.cast().toList() + // SampleEnd + } + + @Test + fun notebook_test_generate_docs_6() { + // SampleStart + df.generateCode("Customer") + // SampleEnd + } + + @Test + fun notebook_test_generate_docs_7() { + // SampleStart + df.cast() + .add("ordersTotal") { orders.sumOf { it.amount } } + .filter { user.startsWith("A") } + .rename { user }.into("customer") + // SampleEnd + // .saveDfHtmlSample() + } +} From 290c419c2eb468e09b186d874d48064cbe3fc23d Mon Sep 17 00:00:00 2001 From: "andrei.kislitsyn" Date: Wed, 14 May 2025 15:52:08 +0400 Subject: [PATCH 2/8] fix sample helper --- .../notebook_test_generate_docs_1.html | 520 ------------------ .../kotlinx/dataframe/samples/api/Generate.kt | 4 +- 2 files changed, 2 insertions(+), 522 deletions(-) delete mode 100644 docs/resources/api/generate_docs/notebook_test_generate_docs_1.html diff --git a/docs/resources/api/generate_docs/notebook_test_generate_docs_1.html b/docs/resources/api/generate_docs/notebook_test_generate_docs_1.html deleted file mode 100644 index 3fd35bf310..0000000000 --- a/docs/resources/api/generate_docs/notebook_test_generate_docs_1.html +++ /dev/null @@ -1,520 +0,0 @@ - - - - - -
- -

- - - diff --git a/tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Generate.kt b/tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Generate.kt index d02d2fa355..fcf1be9419 100644 --- a/tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Generate.kt +++ b/tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Generate.kt @@ -14,10 +14,10 @@ import org.jetbrains.kotlinx.dataframe.api.into import org.jetbrains.kotlinx.dataframe.api.rename import org.jetbrains.kotlinx.dataframe.api.sumOf import org.jetbrains.kotlinx.dataframe.api.toList -import org.jetbrains.kotlinx.kandy.letsplot.samples.SampleHelper +import org.jetbrains.kotlinx.dataframe.samples.DataFrameSampleHelper import org.junit.Test -class Generate : SampleHelper("generate_docs", "api") { +class Generate : DataFrameSampleHelper("generate_docs", "api") { val ordersAlice = dataFrameOf( "orderId" to listOf(101, 102), "amount" to listOf(50.0, 75.5) From 5eeca4a792dc94b34f2756c168c11fd2cf70163b Mon Sep 17 00:00:00 2001 From: "andrei.kislitsyn" Date: Wed, 14 May 2025 15:52:21 +0400 Subject: [PATCH 3/8] add df iframe for generate utilities --- .../notebook_test_generate_docs_1.html | 520 ++++++++++++++++++ 1 file changed, 520 insertions(+) create mode 100644 docs/StardustDocs/resources/api/generate_docs/notebook_test_generate_docs_1.html diff --git a/docs/StardustDocs/resources/api/generate_docs/notebook_test_generate_docs_1.html b/docs/StardustDocs/resources/api/generate_docs/notebook_test_generate_docs_1.html new file mode 100644 index 0000000000..af5795ad21 --- /dev/null +++ b/docs/StardustDocs/resources/api/generate_docs/notebook_test_generate_docs_1.html @@ -0,0 +1,520 @@ + + + + + +
+ +

+ + + From bf07e43072d062cbd99ff3ff1f5bd2eb4c59cfad Mon Sep 17 00:00:00 2001 From: "andrei.kislitsyn" Date: Wed, 14 May 2025 15:54:25 +0400 Subject: [PATCH 4/8] fix shadow resources --- docs/StardustDocs/topics/_shadow_resources.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/StardustDocs/topics/_shadow_resources.md b/docs/StardustDocs/topics/_shadow_resources.md index 7b6832503b..5bb11025ad 100644 --- a/docs/StardustDocs/topics/_shadow_resources.md +++ b/docs/StardustDocs/topics/_shadow_resources.md @@ -159,3 +159,4 @@ + From 1c8064ae74d15d7877a0fa5050efd3fa68cf7ee1 Mon Sep 17 00:00:00 2001 From: "andrei.kislitsyn" Date: Wed, 14 May 2025 15:57:38 +0400 Subject: [PATCH 5/8] fix Utilities-Generation topic --- docs/StardustDocs/topics/Utilities-Generation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/StardustDocs/topics/Utilities-Generation.md b/docs/StardustDocs/topics/Utilities-Generation.md index 5b44d16172..a7fc297084 100644 --- a/docs/StardustDocs/topics/Utilities-Generation.md +++ b/docs/StardustDocs/topics/Utilities-Generation.md @@ -34,7 +34,7 @@ in cases where the schema cannot be inferred automatically from the source. * `CodeString` – A value class wrapper for `String`, containing the generated Kotlin code of `@DataSchema` interfaces without extension properties. -### Examples {id="generateInterfaces-examples"}} +### Examples {id="generateInterfaces-examples"} From 5aecd8896cc0b213fb2f9e50d48f548c9c19a007 Mon Sep 17 00:00:00 2001 From: "andrei.kislitsyn" Date: Wed, 14 May 2025 16:34:09 +0400 Subject: [PATCH 6/8] added function signatures --- .../topics/Utilities-Generation.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/StardustDocs/topics/Utilities-Generation.md b/docs/StardustDocs/topics/Utilities-Generation.md index a7fc297084..d762ae06e2 100644 --- a/docs/StardustDocs/topics/Utilities-Generation.md +++ b/docs/StardustDocs/topics/Utilities-Generation.md @@ -20,6 +20,12 @@ based on the current `DataFrame` schema. ## generateInterfaces +```kotlin +inline fun DataFrame.generateInterfaces(): CodeString + +fun DataFrame.generateInterfaces(markerName: String): CodeString +``` + Generates [`@DataSchema`](schemas.md) interfaces for this `DataFrame` (including all nested `DataFrame` columns and column groups) as Kotlin interfaces. @@ -87,6 +93,16 @@ df.cast<_DataFrameType1>().filter { orders.all { orderId >= 102 } } ## generateDataClasses +```kotlin +inline fun DataFrame.generateDataClasses( + markerName: String? = null, + extensionProperties: Boolean = false, + visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, + useFqNames: Boolean = false, + nameNormalizer: NameNormalizer = NameNormalizer.default, +): CodeString +``` + Generates Kotlin data classes corresponding to the `DataFrame` schema (including all nested `DataFrame` columns and column groups). @@ -152,6 +168,20 @@ val customers: List = df.cast().toList() ## generateCode +```kotlin +inline fun DataFrame.generateCode( + fields: Boolean = true, + extensionProperties: Boolean = true, +): CodeString + +fun DataFrame.generateCode( + markerName: String, + fields: Boolean = true, + extensionProperties: Boolean = true, + visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, +): CodeString +``` + Generates a data schema interface as [`generateInterfaces()`](#generateinterfaces), along with explicit [extension properties](extensionPropertiesApi.md). Useful if you don't use the [compiler plugin](Compiler-Plugin.md). From 76c6d7ed94391787c21fbb66b65ae63c8a2040c5 Mon Sep 17 00:00:00 2001 From: "andrei.kislitsyn" Date: Wed, 14 May 2025 16:43:39 +0400 Subject: [PATCH 7/8] small md list fix --- docs/StardustDocs/topics/Utilities-Generation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/StardustDocs/topics/Utilities-Generation.md b/docs/StardustDocs/topics/Utilities-Generation.md index d762ae06e2..7bfc1867ab 100644 --- a/docs/StardustDocs/topics/Utilities-Generation.md +++ b/docs/StardustDocs/topics/Utilities-Generation.md @@ -111,7 +111,7 @@ Useful when you want to: - Work with the data as regular Kotlin data classes. - Work with data classes serialization. - Extract structured types for further use in your application. -- + ### Arguments {id="generateDataClasses-arguments"} * `markerName`: `String?` — The base name to use for generated data classes. If `null`, uses the `T` type argument of `DataFrame` simple name. From 5578c5b38a0740521fbefc970ab6b0d59fa1c432 Mon Sep 17 00:00:00 2001 From: "andrei.kislitsyn" Date: Wed, 14 May 2025 17:03:13 +0400 Subject: [PATCH 8/8] rename and move generation topic --- .../explainer/SamplesRenderingUtils.kt | 2 +- docs/StardustDocs/d.tree | 2 +- ... => DataSchema-Data-Classes-Generation.md} | 2 +- .../kotlinx/dataframe/samples/api/Generate.kt | 95 +++++++++++-------- 4 files changed, 59 insertions(+), 42 deletions(-) rename docs/StardustDocs/topics/{Utilities-Generation.md => DataSchema-Data-Classes-Generation.md} (99%) diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/SamplesRenderingUtils.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/SamplesRenderingUtils.kt index 28e7205354..0ec2122ed0 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/SamplesRenderingUtils.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/SamplesRenderingUtils.kt @@ -96,7 +96,7 @@ allObservedTables.forEach((table) => { characterData: true, }); }); - """.trimIndent() + """.trimIndent(), ) val WritersideFooter: (DataFrame<*>) -> String = { "" } diff --git a/docs/StardustDocs/d.tree b/docs/StardustDocs/d.tree index 3db96f109d..467e28eeb8 100644 --- a/docs/StardustDocs/d.tree +++ b/docs/StardustDocs/d.tree @@ -191,12 +191,12 @@ - +