Macro pact_consumer::patterns::object_matching
source ยท macro_rules! object_matching { ($example:expr, [ $( $rule:expr ),* ]) => { ... }; }
Expand description
A pattern which can take a JSON pattern and then apply a number of matching rules to the resulting JSON object.
use pact_consumer::*;
use pact_consumer::prelude::{each_key, each_value};
object_matching!(
json_pattern!({
"key1": "a string",
"key2": "1",
}),
[
each_key(matching_regex!("[a-z]{3}[0-9]", "key1")),
each_value(like!("value1"))
]
);