/snakeyaml-engine-kmp

A Kotlin Multiplatform port of snakeyaml-engine

Primary LanguageKotlinApache License 2.0Apache-2.0

Maven Central Version Commits to upstream

SnakeYAML Engine KMP

Overview

SnakeYAML Engine KMP is a YAML 1.2 processor for Kotlin Multiplatform, and supports

  • Kotlin/JS,
  • Kotlin/JVM,
  • Kotlin/Native,
  • Kotlin/Wasm.

SnakeYAML Engine KMP is based on SnakeYAML Engine.

Tip

Are you wondering if SnakeYAML Engine KMP is for you?

SnakeYAML Engine KMP offers fine-grained control and advanced functionality, which is a good fit if you need more customization and flexibility.

If you're for a hassle-free YAML (de)serialization experience, we recommend using kaml, which is designed for simplicity and ease of integration.

Status

The library has been successfully ported to KMP, and is consumed by kaml, a library that integrates with kotlinx.serialization.

SnakeYAML Engine KMP uses comprehensive YAML test suites that validate correctness. Detailed performance testing wasn't conducted, however we have performance reports (see here) and mechanisms in place that should prevent performance regressions.

How to use

SnakeYAML Engine KMP is published to Maven Central.

// build.gradle.kts

repositories {
    mavenCentral()
}

dependencies {
    implementation("it.krzeminski:snakeyaml-engine-kmp:x.y.z")
}

To learn about the API, view the reference documentation.

We also recommend reading SnakeYAML Engine's documentation.

Snapshot releases

Snapshot versions of SnakeYAML Engine KMP (straight from the main branch) are available. They are published to a GitHub branch, which must be added as a custom Gradle Plugin repository

// settings.gradle.kts

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
    repositories {
        mavenCentral()
        gradlePluginPortal()

        // add the snapshot repository
        maven("https://raw.githubusercontent.com/krzema12/snakeyaml-engine-kmp/artifacts/m2/") {
            name = "SnakeYAML Engine KMP Snapshots"
            mavenContent {
                // only include the relevant snapshots
                includeGroup("it.krzeminski")
                snapshotsOnly()
            }
        }
    }
}

Once the repository is configured, add a dependency on the library:

// build.gradle.kts

dependencies {
    implementation("it.krzeminski:snakeyaml-engine-kmp:x.y.z-SNAPSHOT")
}