Skip to main content

resolve_args

Function resolve_args 

Source
pub fn resolve_args(
    args: &mut Value,
    prior_responses: &[Invocation],
) -> Result<(), JmapError>
Expand description

Resolve all #key ResultReference fields in args against prior_responses.

For every key in args that starts with #:

  1. Parse the value as a ResultReference.
  2. Find the prior response whose call-id matches rr.result_of (index 2 of tuple).
  3. Verify rr.name matches the method name of that response (index 0 of tuple).
  4. Apply rr.path as an RFC 6901 JSON Pointer (with RFC 8620 §3.7 * extension) to the response args (index 1 of tuple).
  5. Collect (plain_key, resolved_value) pairs.

This is two-phase atomic: args is not modified at all unless every #key resolves successfully. If any resolution fails, args is returned unchanged and an error is returned.

prior_responses entries are (method_name, response_args, call_id) — same layout as Invocation.