pub struct CircularDependency {
pub files: Vec<PathBuf>,
pub length: usize,
pub line: u32,
pub col: u32,
pub edges: Vec<CircularDependencyEdge>,
pub is_cross_package: bool,
}Expand description
A circular dependency chain detected in the module graph.
The line and col fields carry #[serde(default)] so callers reading
historical baseline JSON without these fields can still deserialize the
struct, but the JSON output layer always emits them (u32 always
serializes, never via skip_serializing_if). The schemars derive sees
the serde defaults and marks both fields optional in the generated
schema; the explicit extend("required" = ...) override here keeps the
schema’s required array honest about what the JSON output actually
contains.
edges is deliberately kept OUT of the required extend: it is
#[serde(default)] (so historical baseline JSON without it still
deserializes) and the output layer always emits it, but listing it in
required would make pre-upgrade JSON fail validation against the new
schema. It is a normal additive field: always present in current output,
optional for backward compatibility.
Fields§
§files: Vec<PathBuf>Files forming the cycle, in import order.
length: usizeNumber of files in the cycle.
line: u321-based line number of the import that starts the cycle (in the first file).
col: u320-based byte column offset of the import that starts the cycle.
edges: Vec<CircularDependencyEdge>Per-file import anchors, one entry per hop in cycle order: edges[i]
is the import in files[i] pointing to files[(i + 1) % len]. Always
the same length as files. Drives the per-file LSP diagnostic
squiggly. #[serde(default)] so pre-edges baselines deserialize;
always emitted on output but intentionally not in the schema’s
required set (see the struct doc).
is_cross_package: boolWhether this cycle crosses workspace package boundaries.