stubr 0.6.2

Wiremock implemented in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use jsonpath_lib::Compiled;
use serde_json::Value;

use super::JsonMatcher;

pub struct JsonPathMatcher<'a>(pub &'a Compiled);

impl<'a> JsonMatcher<'a> for JsonPathMatcher<'a> {
    fn matches(&self, json: &'a Value) -> bool {
        self.0.select(json).ok().filter(|it| !it.is_empty()).is_some()
    }
}