has_only_paths

Function has_only_paths 

Source
pub fn has_only_paths(
    paths: &[&str],
) -> JsonPredicateMatcher<impl Fn(&Value) -> bool, String, String>
Expand description

Matches a JSON object whose paths are exactly the provided set (no extras or missing).

§Examples

let value = j!({"ids": [1, 2], "ok": true});
assert_that!(value, json::has_only_paths(&["ids", "ids.0", "ids.1", "ok"]));

§Errors

Fails when any path is invalid, when the value is not a JSON object, or when the set of paths differs.