Graph Library for Kotlin

Describe each type's object graph once, and let validation, projection and your own plugins build on it.

What's inside

Discover the capabilities built to elevate your Kotlin applications.

Declarative Graph DSL

Describe a type once with graph<T> { }, and give the description a name of its own by delegation. A graph is built once, is immutable and can be shared across threads.

Graph Registry

Collect graphs in a registry that resolves nested types automatically, matching each object's runtime class across its superclasses and interfaces, from the most general graph to the most specific.

Configuration Checked Up Front

Problems in a registry's configuration, such as two graphs for the same type, are found as soon as it's built and reported together in a single exception, before anything relies on them.

Members and Paths

Properties, collection elements and map keys and values are all members with a path, such as Customer.orders[2].total. Paths can be compared, extended and matched against wildcards like Customer.orders[*].total.

Path Formats

Paths render as Kotlin-style paths, JSON Pointers (RFC 6901) or JSONPath expressions (RFC 9535), with property names transformed to match your API, such as snake case, or in a format of your own.

Member Access Policies

Decide which members plugins may read, for example to skip lazy JPA associations that haven't been loaded, and leave out infrastructure members inherited from base types.

Plugin Extension Points

Validation and projection are plugins, and you can write your own: a plugin adds its DSL to the graph builder, keeps its definitions on each graph, and can verify them when the registry is built.