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

Function unwrap_container

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

Transparently unwrap one layer of container indirection (array → items, map → additionalProperties). Returns the element schema if a container, else returns the input unchanged. Used so `explain reply.evidence` shows the Evidence variants directly and `explain state.steps` shows the StepState fields directly.

(rs: &RootSchema, obj: &SchemaObject)

Source from the content-addressed store, hash-verified

363/// the Evidence variants directly and `explain state.steps` shows the
364/// StepState fields directly.
365fn unwrap_container(rs: &RootSchema, obj: &SchemaObject) -> SchemaObject {
366 let s = resolve(rs, obj);
367 if let Some(item) = array_item(s) {
368 return resolve(rs, item).clone();
369 }
370 if let Some(value) = map_value(s) {
371 return resolve(rs, value).clone();
372 }
373 s.clone()
374}
375
376/// Render a minimal valid JSON example for the schema. Always ends with a newline
377/// so the output is line-clean when piped to a file or another command.

Callers 1

render_plaintextFunction · 0.85

Calls 3

array_itemFunction · 0.85
map_valueFunction · 0.85
resolveFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…