Skip to main content

lookup

Function lookup 

Source
pub fn lookup<'a>(
    value: &'a Value,
    path: &[String],
    command: Option<&str>,
) -> Option<&'a Value>
Expand description

Walks a dotted path inside value.

GAP-SG-230: when the last segment names a field this project spells more than one way, the sibling spellings are tried before answering None. This is the one place worth doing it, because it is the ONE accessor all four shaping knobs share — FilterExpr::matches, super::shape::sort, super::shape::dedupe and shape::project_with all reach the payload through here. Resolving anywhere upstream would have meant rewriting the caller’s key in four places, and FilterExpr keeps its path private precisely so nobody does that.

The fallback runs only when the direct walk already failed, so the hot path pays one Option test and nothing else. A payload that carries the requested spelling never consults the table at all.

GAP-SG-274: command is the subcommand slug the surface resolved, and it selects which groups of the table are in force — kind names the entity type under graph and the line discriminator under graph-ndjson.