1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! JSON-body inspection used by rule matching.
//!
//! # Why only one helper lives here
//!
//! Pre-5.0 this module also contained `resolve_with_json_compatible_extensions`
//! and `is_equivalent_json_file` — both of which are filesystem-touching
//! utilities used by the dyn-route fallback. In the 5.0 split those
//! moved to `apimock-server` where they belong. What stays here is the
//! one helper the *matcher* calls on every request with a JSON body.
use Value;
/// File extensions treated as "JSON-compatible" for the fallback route.
///
/// Referenced from `apimock-server` via re-export for the dyn-route
/// fallback. Stays in routing because the *definition* of what counts
/// as a JSON-like file is a routing-semantics concern.
pub const JSON_COMPATIBLE_EXTENSIONS: = ;
/// Look up a value inside a JSON document using a dotted-path key.
///
/// # Why a home-rolled mini-JSONPath instead of a crate
///
/// We only support the "object key" and "array index" forms — no
/// wildcards, no filters. Those two cover every real use inside this
/// codebase (`body.json` matchers, CSV record-wrapping key). Pulling
/// in a full JSONPath crate would add weight and expose features we
/// would then have to teach users to avoid.
///
/// Supported shapes:
/// - `a.b.c` for nested object keys
/// - `0.foo` / `items.2.name` for array indexing with a numeric segment
///
/// Returns `None` if any segment is missing or has the wrong shape
/// (e.g. trying to index an object with a numeric string, or vice versa).