Skip to main content

parse

Function parse 

Source
pub fn parse(
    existing: Option<&str>,
    project_root: &Path,
) -> Result<SchemaRegistry, String>
Expand description

Parse bynk.schema.lock’s content. existing: None means the project has no lock file yet — a fresh project’s first reconciliation, baselined rather than compared, exactly as a missing file always meant back when this function read the file itself. It must mean verified absent, never “content unavailable” for some other reason — see SchemaLock::On’s doc comment, which states that invariant on the type the caller constructs.

Some(text) that is empty/unparseable/a different lock version is corruption, not a fresh project, and fails hard (ledger.rs’s own argument for the identical case) — never silently re-baselines.

project_root is used only to name the file in an error message — #1078 made this function disk-free (and so path-blind) for the content itself; #1085 review restored the location context a corruption diagnostic lost as a result, without reintroducing any fs/Path I/O here.