No description
  • Kotlin 96.2%
  • ANTLR 3.8%
Find a file
Mallne a1250f0055 Upgrade dependencies and refine Gradle scripts
Updated several dependencies including Kotlin, Ktor, and Maven Publish to newer versions. Improved Gradle scripts by replacing `properties` with `project.findProperty` for enhanced property resolution. Adjusted Gradle wrapper configurations and fixed syntax for better consistency in source set declarations.
2026-07-13 20:23:39 +02:00
.github Modules 2024-04-17 23:07:51 +02:00
core Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:51 +02:00
gradle Upgrade dependencies and refine Gradle scripts 2026-07-13 20:23:39 +02:00
tokenizer Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:51 +02:00
.dockerignore Remove server module, translation-keys plugin, and update build configuration. 2025-07-15 15:23:36 +02:00
.gitignore Refactor and modularize Weaver AST and grammar definitions. 2025-07-20 13:16:24 +02:00
AGENTS.md Add published documentation hierarchy to AGENTS.md 2026-06-02 14:56:12 +02:00
build.gradle.kts Align Dependencies and better support for JS Target 2026-03-17 23:17:51 +01:00
gradle.properties Remove server module, translation-keys plugin, and update build configuration. 2025-07-15 15:23:36 +02:00
LICENSE Remove server module, translation-keys plugin, and update build configuration. 2025-07-15 15:23:36 +02:00
README.md Add Readme and Agents Files 2026-03-19 21:40:13 +01:00
settings.gradle.kts Remove :polyfill module references and simplify Gradle configurations 2025-07-29 23:07:35 +02:00

DiCentra Weaver

DiCentra Kotlin License Kotlin Multiplatform

DiCentra Weaver is a powerful, schema-driven transformation framework designed to map and process JSON data using a specialized expression language. Built with Kotlin Multiplatform, it provides a consistent transformation engine across JVM, Android, iOS, JS, and Wasm targets.

Features

  • Schema-Driven Transformations: Define your data mapping rules in a structured schema.
  • Weaver Object Language (WOL): A rich expression language for dynamic data access and computation.
  • Kotlin Multiplatform: Run the same transformation logic on any platform.
  • Extensible Architecture: Easily add custom functions and plugins.
  • High Performance: Efficiently handles complex JSON structures.

Installation

Add the dependency to your build.gradle.kts:

implementation("cloud.mallne.dicentra.weaver:core:1.0.0-SNAPSHOT")

Weaver Object Language (WOL)

WOL is the core of Weaver's transformation capabilities. It comes in two flavors: Accessor WOL for path traversal and Computation WOL for logic and arithmetic.

1. Accessor WOL

Used to navigate JSON structures and interpolate values.

Example Description
user.id Accesses the id field of the user object.
items[0] Accesses the first element of the items array.
{otherSchema.id} Interpolates a value from another schema.
{#transform#} Calls a LimboObject (a named transformation).
{##param##} Accesses a parameter passed to the transformation.
{|#val#|i|} Coerces the result of {#val#} to an integer.

2. Computation WOL

Used for logic, arithmetic, and more complex transformations.

Category Examples
Arithmetic 1 + 2, (10 * {price}) / 2, 5 % 2
Logic true && {isAdmin}, !{isBlocked}, (5 > 2) || false
Comparison {age} >= 18, 'admin' == {role}, 5 != 10
Ternary {score} > 50 ? 'Pass' : 'Fail'
Elvis Operator {name} ?: 'Anonymous'
Coercion |{count}|s| (ToString), |'true'|b| (ToBoolean)
Functions pow(2, 8), max({a}, {b})

Usage Example

val weaver = Weaver()
val schema = WeaverSchema(
    key = "userProfile",
    root = PropertyDeclaration(
        content = "{#transformedUser#}"
    ),
    transforms = listOf(
        LimboObjectDeclaration(
            name = "transformedUser",
            // Define your transformation logic here
        )
    )
)

val engine = weaver.engine(schema)
val result = engine.execute<UserProfile>(inputJson)

Module Overview

  • core: The main execution engine and schema model.
  • tokenizer: ANTLR-based parser for the Weaver Object Language.

License

This project is licensed under the Apache License 2.0. See LICENSE for details.


Built with ❤️ by Mallne under the DiCentra umbrella