diff --git a/CHANGELOG.md b/CHANGELOG.md index ac4a5574..36105b78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added ### Changed +- Meta to Json serializer now serializes a single item with index as an array. It is important for plotly integration. ### Deprecated diff --git a/README.md b/README.md deleted file mode 100644 index b6a8a566..00000000 --- a/README.md +++ /dev/null @@ -1,49 +0,0 @@ -[![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) -[![DOI](https://zenodo.org/badge/148831678.svg)](https://zenodo.org/badge/latestdoi/148831678) - -![Gradle build](https://github.com/mipt-npm/dataforge-core/workflows/Gradle%20build/badge.svg) - -
- -* ### [dataforge-context](dataforge-context) -> -> -> **Maturity**: DEVELOPMENT -
- -* ### [dataforge-data](dataforge-data) -> -> -> **Maturity**: EXPERIMENTAL -
- -* ### [dataforge-io](dataforge-io) -> -> -> **Maturity**: PROTOTYPE -
- -* ### [dataforge-meta](dataforge-meta) -> -> -> **Maturity**: DEVELOPMENT -
- -* ### [dataforge-scripting](dataforge-scripting) -> -> -> **Maturity**: PROTOTYPE -
- -* ### [dataforge-workspace](dataforge-workspace) -> -> -> **Maturity**: EXPERIMENTAL -
- -* ### [dataforge-io-yaml](dataforge-io/dataforge-io-yaml) -> YAML meta converters and Front Matter envelope format -> -> **Maturity**: PROTOTYPE -
- diff --git a/build.gradle.kts b/build.gradle.kts index 5b886e58..883306ea 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.6.2-dev-kotlin-1.9.0" + version = "0.6.2-dev-2" } subprojects { diff --git a/dataforge-io/build.gradle.kts b/dataforge-io/build.gradle.kts index 91319d4d..9f2030c7 100644 --- a/dataforge-io/build.gradle.kts +++ b/dataforge-io/build.gradle.kts @@ -10,8 +10,8 @@ kscience { jvm() js() native() - useSerialization("1.4.1") - useSerialization("1.4.1", sourceSet = space.kscience.gradle.DependencySourceSet.TEST) { + useSerialization() + useSerialization(sourceSet = space.kscience.gradle.DependencySourceSet.TEST) { cbor() } dependencies { @@ -20,6 +20,6 @@ kscience { } } -readme{ +readme { maturity = space.kscience.gradle.Maturity.PROTOTYPE } \ No newline at end of file diff --git a/dataforge-io/dataforge-io-yaml/build.gradle.kts b/dataforge-io/dataforge-io-yaml/build.gradle.kts index b33e1b9a..505ce360 100644 --- a/dataforge-io/dataforge-io-yaml/build.gradle.kts +++ b/dataforge-io/dataforge-io-yaml/build.gradle.kts @@ -4,10 +4,6 @@ plugins { description = "YAML meta IO" -repositories { - mavenCentral() -} - kscience { jvm() js() @@ -20,10 +16,6 @@ kscience { } } -repositories{ - maven("https://dl.bintray.com/mamoe/yamlkt") -} - readme{ maturity = space.kscience.gradle.Maturity.PROTOTYPE description =""" diff --git a/dataforge-meta/build.gradle.kts b/dataforge-meta/build.gradle.kts index decf0760..51b07113 100644 --- a/dataforge-meta/build.gradle.kts +++ b/dataforge-meta/build.gradle.kts @@ -6,7 +6,7 @@ kscience { jvm() js() native() - useSerialization("1.4.1"){ + useSerialization{ json() } } diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt index e36f0e55..98f0c3e4 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt @@ -23,7 +23,6 @@ public fun Value.toJson(descriptor: MetaDescriptor? = null): JsonElement = when } //Use these methods to customize JSON key mapping -@Suppress("NULLABLE_EXTENSION_OPERATOR_WITH_SAFE_CALL_RECEIVER") private fun String.toJsonKey(descriptor: MetaDescriptor?) = descriptor?.attributes?.get("jsonName").string ?: toString() private fun Meta.toJsonWithIndex(descriptor: MetaDescriptor?, index: String?): JsonElement = if (items.isEmpty()) { @@ -35,9 +34,13 @@ private fun Meta.toJsonWithIndex(descriptor: MetaDescriptor?, index: String?): J val childDescriptor = descriptor?.children?.get(body) if (list.size == 1) { val (token, element) = list.first() - //do not add empty element - val child: JsonElement = element.toJsonWithIndex(childDescriptor, token.index) - body to child + //do not add an empty element + val child: JsonElement = element.toJsonWithIndex(childDescriptor, token.index) + if(token.index == null) { + body to child + } else { + body to JsonArray(listOf(child)) + } } else { val elements: List = list.sortedBy { it.key.index }.mapIndexed { index, entry -> //Use index if it is not equal to the item order diff --git a/docs/templates/ARTIFACT-TEMPLATE.md b/docs/templates/ARTIFACT-TEMPLATE.md deleted file mode 100644 index 6b921b05..00000000 --- a/docs/templates/ARTIFACT-TEMPLATE.md +++ /dev/null @@ -1,29 +0,0 @@ -> #### Artifact: -> -> This module artifact: `${group}:${name}:${version}`. -> -> -> [![Maven Central](https://img.shields.io/maven-central/v/space.kscience/${name}.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22%20AND%20a:%22${name}%22) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> } -> -> dependencies { -> implementation '${group}:${name}:${version}' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://https://repo.kotlin.link") -> } -> -> dependencies { -> implementation("${group}:${name}:${version}") -> } -> ``` \ No newline at end of file diff --git a/docs/templates/README-TEMPLATE.md b/docs/templates/README-TEMPLATE.md index a28f0db3..762e5d7e 100644 --- a/docs/templates/README-TEMPLATE.md +++ b/docs/templates/README-TEMPLATE.md @@ -3,4 +3,4 @@ ![Gradle build](https://github.com/mipt-npm/dataforge-core/workflows/Gradle%20build/badge.svg) -$modules +${modules} diff --git a/gradle.properties b/gradle.properties index df992b2c..27743a30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.mpp.stability.nowarn=true kotlin.incremental.js.ir=true kotlin.native.ignoreDisabledTargets=true -toolsVersion=0.14.9-kotlin-1.9.0 +toolsVersion=0.14.9-kotlin-1.8.20