MCPcopy Create free account
hub / github.com/AIScientists-Dev/Flowtrace / explain

Function explain

crates/flowtrace-cli/src/explain.rs:37–49  ·  view source on GitHub ↗

Entry point: render the schema rooted at `path` in the requested format.

(path: &str, fmt: ExplainFormat)

Source from the content-addressed store, hash-verified

35
36/// Entry point: render the schema rooted at `path` in the requested format.
37pub fn explain(path: &str, fmt: ExplainFormat) -> Result<String> {
38 let (root, rest) = split_root(path)?;
39 let schema = root_schema_for(root);
40 let target =
41 navigate(&schema, &schema.schema, &rest).with_context(|| {
42 format!("path `{}` does not exist in `{}` schema", path, root)
43 })?;
44 Ok(match fmt {
45 ExplainFormat::Plaintext => render_plaintext(root, &rest, &schema, &target),
46 ExplainFormat::Example => render_example(&schema, &target),
47 ExplainFormat::Jsonschema => render_jsonschema(&schema, &target),
48 })
49}
50
51/// Split `reply.evidence.figure` into (`reply`, `["evidence", "figure"]`).
52/// Errors with a hint if the root is unknown.

Calls 6

split_rootFunction · 0.85
root_schema_forFunction · 0.85
navigateFunction · 0.85
render_plaintextFunction · 0.85
render_exampleFunction · 0.85
render_jsonschemaFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…