pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

Question: Can you combine Matchers with Integration JSON? #249

Open orj opened 1 year ago

orj commented 1 year ago

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?

rholshausen commented 1 year ago

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.

YOU54F commented 2 months ago

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