
Captures the path to a deserialization error, exposing the field/key chain for precise error location with Serde-compatible deserializers. Faithful, in-progress line-by-line transliteration.
This is a Kotlin Multiplatform line-by-line transliteration port of dtolnay/path-to-error.
Original Project: This port is based on dtolnay/path-to-error. All design credit and project intent belong to the upstream authors; this repository is a faithful port to Kotlin Multiplatform with no behavioural changes intended.
This is an in-progress port. The goal is feature parity with the upstream Rust crate while providing a native Kotlin Multiplatform API. Every Kotlin file carries a // port-lint: source <path> header naming its upstream Rust counterpart so the AST-distance tool can track provenance.
The text below is reproduced and lightly edited from
https://github.com/dtolnay/path-to-error. It is the upstream project's own description and remains under the upstream authors' authorship; links have been rewritten to absolute upstream URLs so they continue to resolve from this repository.
Find out the path at which a deserialization error occurred. This crate provides
a wrapper that works with any existing Serde Deserializer and exposes the
chain of field names leading to the error.
[dependencies]
serde = "1.0"
serde_path_to_error = "0.1"use serde::Deserialize;
use std::collections::BTreeMap as Map;
#[derive(Deserialize)]
struct Package {
name: String,
dependencies: Map<String, Dependency>,
}
#[derive(Deserialize)]
struct Dependency {
version: String,
}
fn main() {
let j = r#"{
"name": "demo",
"dependencies": {
"serde": {
"version": 1
}
}
}"#;
// Some Deserializer.
let jd = &mut serde_json::Deserializer::from_str(j);
let result: Result<Package, _> = serde_path_to_error::deserialize(jd);
match result {
Ok(_) => panic!("expected a type error"),
Err(err) => {
let path = err.path().to_string();
assert_eq!(path, "dependencies.serde.version");
}
}
}dependencies {
implementation("io.github.kotlinmania:serde-path-to-error-kotlin:0.1.0")
}./gradlew build
./gradlew testSee AGENTS.md and CLAUDE.md for translator discipline, port-lint header convention, and Rust → Kotlin idiom mapping.
This Kotlin port is distributed under the same MIT license as the upstream dtolnay/path-to-error. See LICENSE (and any sibling LICENSE-* / NOTICE files mirrored from upstream) for the full text.
Original work copyrighted by the path-to-error authors.
Kotlin port: Copyright (c) 2026 Sydney Renee and The Solace Project.
Thanks to the dtolnay/path-to-error maintainers and contributors for the original Rust implementation. This port reproduces their work in Kotlin Multiplatform; bug reports about upstream design or behavior should go to the upstream repository.
This is a Kotlin Multiplatform line-by-line transliteration port of dtolnay/path-to-error.
Original Project: This port is based on dtolnay/path-to-error. All design credit and project intent belong to the upstream authors; this repository is a faithful port to Kotlin Multiplatform with no behavioural changes intended.
This is an in-progress port. The goal is feature parity with the upstream Rust crate while providing a native Kotlin Multiplatform API. Every Kotlin file carries a // port-lint: source <path> header naming its upstream Rust counterpart so the AST-distance tool can track provenance.
The text below is reproduced and lightly edited from
https://github.com/dtolnay/path-to-error. It is the upstream project's own description and remains under the upstream authors' authorship; links have been rewritten to absolute upstream URLs so they continue to resolve from this repository.
Find out the path at which a deserialization error occurred. This crate provides
a wrapper that works with any existing Serde Deserializer and exposes the
chain of field names leading to the error.
[dependencies]
serde = "1.0"
serde_path_to_error = "0.1"use serde::Deserialize;
use std::collections::BTreeMap as Map;
#[derive(Deserialize)]
struct Package {
name: String,
dependencies: Map<String, Dependency>,
}
#[derive(Deserialize)]
struct Dependency {
version: String,
}
fn main() {
let j = r#"{
"name": "demo",
"dependencies": {
"serde": {
"version": 1
}
}
}"#;
// Some Deserializer.
let jd = &mut serde_json::Deserializer::from_str(j);
let result: Result<Package, _> = serde_path_to_error::deserialize(jd);
match result {
Ok(_) => panic!("expected a type error"),
Err(err) => {
let path = err.path().to_string();
assert_eq!(path, "dependencies.serde.version");
}
}
}dependencies {
implementation("io.github.kotlinmania:serde-path-to-error-kotlin:0.1.0")
}./gradlew build
./gradlew testSee AGENTS.md and CLAUDE.md for translator discipline, port-lint header convention, and Rust → Kotlin idiom mapping.
This Kotlin port is distributed under the same MIT license as the upstream dtolnay/path-to-error. See LICENSE (and any sibling LICENSE-* / NOTICE files mirrored from upstream) for the full text.
Original work copyrighted by the path-to-error authors.
Kotlin port: Copyright (c) 2026 Sydney Renee and The Solace Project.
Thanks to the dtolnay/path-to-error maintainers and contributors for the original Rust implementation. This port reproduces their work in Kotlin Multiplatform; bug reports about upstream design or behavior should go to the upstream repository.