Skip to main content

expand_path_pattern

Function expand_path_pattern 

Source
pub fn expand_path_pattern(
    root: &Value,
    pattern: &str,
    addressing: Addressing<'_>,
    missing: MissingContainer,
) -> DocumentResult<Vec<String>>
Expand description

Resolve a path pattern against root into the concrete paths it names.

A bare * segment (see parse_path_pattern) stands for every child of the container at that point: an object’s keys in document order, or an array’s indices. The results are ordinary paths in the one grammar — a star key in one comes back escaped as \* — so each reads back through locate or get_path. A pattern without a wildcard is returned exactly as written, one path.

Only the containers a wildcard expands are resolved here. Segments after the last wildcard are copied, not checked, so a child that lacks the field the pattern goes on to name still yields its path, and reading that path is where the miss is reported — with any fallback the caller has for it.