Open
Description
We’re working on using matchers using the pactffi_matches_json_value function, and are seeing some unexpected behavior for some more advanced rules where the check passes even though it shouldn’t… For example, with an arrayContains matching rule, no error is returned even though an array with one element that doesn’t satisfy the matching rules is passed to it.
Here’s the line in the pactffi log for the check:
2025-03-31T15:16:12.632536Z DEBUG ThreadId(01) pact_matching::json: JSON -> JSON: Comparing '[{"baz":42,"foo":"bar"}]' to '["bla"]' using ArrayContains([(0, MatchingRuleCategory { name: BODY, rules: {DocPath { path_tokens: [Root, Field("baz")], expr: "$.baz" }: RuleList { rules: [Type], rule_logic: And, cascaded: false }} }, {})]) -> Ok(())
This is the body set in the pactffi_with_body call:
{
"payload": {
"property": {
"pact:matcher:type": "arrayContains",
"variants": [
{
"baz": {
"pact:matcher:type": "type",
"value": 42
},
"foo": "bar"
}
]
}
}
}
I've pulled the matching rule from the pact model by iterating, in json it gets set to thi:
{
"match": "arrayContains",
"variants": [
{
"index": 0,
"rules": {
"$.baz": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
}
]
}
We’re using pactffi release 0.4.26 btw, am I missing something here?
Metadata
Metadata
Assignees
Labels
No labels