pact-reference icon indicating copy to clipboard operation
pact-reference copied to clipboard

Combined Matchers - AND (implemented) or OR (to be implemented)

Open orj opened this issue 2 years ago • 3 comments

I have a question regarding matchers specified via the Pact FFI IntegrationJSON format.

Is there a way of combining matchers? From what I understand matchers can be combined in terms of "AND" and "OR" semantics. So it would be cool to specify say a bit of a response or request was both "a string" and also must be not empty. Eg, an "AND" combine of the "type" and "notEmpty" matchers.

Can this be done via the "Integration JSON" method?

orj avatar Jan 16 '23 05:01 orj

Unfortunately, the Pact FFI Integration JSON format only allows specifying a single matcher. However, as part of the plugins work we developed a matching rule expression language, which does allow multiple matchers. We could update the JSON format to support the expressions.

rholshausen avatar Jan 30 '23 05:01 rholshausen

Does https://github.com/pact-foundation/pact-reference/pull/405 resolve this at least for the AND case

YOU54F avatar Jun 09 '24 17:06 YOU54F