Skip to main content

diagnostics_for_path

Function diagnostics_for_path 

Source
pub fn diagnostics_for_path(path: &str) -> Vec<Diagnostic>
Expand description

Validates a JSONPath expression syntactically without evaluating it against any document. Intended for live editor feedback where the user is still composing a query and no document context is available or needed.

The returned diagnostic always spans the entire expression string (0..len) because serde_json_path does not expose sub-expression byte offsets.

§Arguments

  • path - The raw JSONPath expression string slice to validate.

§Returns

  • An empty Vec<Diagnostic> if the expression is syntactically valid.
  • A single-element Vec<Diagnostic> whose span covers the full input string and whose message describes the parse failure if the expression is invalid.