skema
Used in: combo, klause, kumulant.
Skema is a Kotlin Multiplatform library for declaring typed schemas that double as a wire format. One definition gives producers compile-time typed access to their own fields and gives consumers a kotlinx-serializable document they can decode and walk by name without sharing the Kotlin code. It’s a meta-library aimed at people writing other libraries whose users declare schemas that have to travel over the wire as YAML or JSON.
The shape is a heterogeneous map keyed by typed keys, assembled through a type-safe builder so the body reads like the underlying notation. A diff operation reports drift between two versions of a schema, and two composition operators let larger schemas be assembled plugin-style from smaller ones: concatenation merges two schemas at the same level, namespacing prefixes one before the join. Kumulant, klause, and combo are converging onto it as their common wire-friendly shape.
A built-in JSON Schema vocabulary mirrors draft 2020-12, covering primitives, arrays, objects, the standard composition and conditional operators, references, and annotations. A schema parameterised over that vocabulary renders to a JSON Schema document for free. Domain-specific vocabularies plug a per-entry mapper into the same call, and the type system rules out forgetting one at compile time.
Install
dependencies {
implementation("com.eignex:skema:0.3.0")
}
Where to go next
- API reference — full KDoc, generated from the
current
mainbranch. - Changelog — release notes.