Expand description
Stable public schema for codedash code metrics output.
This crate defines the external contract for codedash’s analysis JSON. It is decoupled from codedash’s internal domain model via an Anti-Corruption Layer (ACL), so internal refactoring does not break external consumers.
§Design: Anti-Corruption Layer
codedash maintains two separate type hierarchies:
- Internal domain model (
codedash::domain::ast) — optimized for parsing and enrichment logic. May change across codedash versions. - Public schema (this crate) — stable, versioned contract for external consumers.
The ACL boundary (codedash::port::schema) converts domain types into
these schema types via From implementations. This is the only place
where the two models touch. As a result:
- Internal refactoring in codedash never breaks consumers of this crate.
- This crate carries minimal dependencies (
serdeonly). - Breaking changes to the schema follow semver.
§For Rust consumers
use codedash_schemas::AstData;
let data: AstData = serde_json::from_str(json).unwrap();§For non-Rust consumers (JSON Schema)
Enable the schema feature and generate a JSON Schema file:
ⓘ
let schema = schemars::schema_for!(codedash_schemas::AstData);
println!("{}", serde_json::to_string_pretty(&schema).unwrap());The generated schema can then be used by TypeScript, Python, Go, etc. to validate or generate types for codedash output.
§Optional features
schema— derives [schemars::JsonSchema] on all types, enabling JSON Schema generation viaschemars::schema_for!.
Structs§
- AstData
- Top-level AST output from a codedash analysis run.
- Call
Info - A call reference from a function body to an imported symbol.
- Edge
- A dependency edge between two files.
- File
Data - Per-file AST data.
- Import
Info - An internal import (e.g.
use crate::domain::ast::AstData). - Node
Data - A single AST node (function, struct, enum, impl, etc.).