Skip to content

feat(matcher): add matchAny (OR) matcher and likeOrNull - #6

Draft
YOU54F wants to merge 4 commits into
masterfrom
feat/or-matcher
Draft

YOU54F wants to merge 4 commits into
masterfrom
feat/or-matcher

Conversation

@YOU54F

@YOU54F YOU54F commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Summary

Adds matchers that combine rules with OR, emitted as integration JSON with "pact:matcher:combine": "OR":

  • Matcher::matchAny(...) (MatchAny): matches if any of the matchers match.
  • likeOrNull(), and docs for using nullValue() as an alternative.

Also adds docs in docs/consumer.md, unit tests and an example/or-matcher consumer and provider example.

Testing

The unit tests and the or-matcher example (10 tests) passed locally against a pact_ffi build with pact-foundation#601.

Note: example/matchers will need updating on the next pact_ffi bump anyway because of pact-foundation#587 (1f1c2e61). That is unrelated to OR.

Depends on

Warning

The last commit (test: consume pact_ffi 0.5.13-or.1 … (revert before merge)) points this repo at the fork prerelease so CI can test it end to end. Revert it and bump to the released pact_ffi before merging upstream.

🤖 Generated with Claude Code

YOU54F and others added 4 commits November 9, 2026 17:32
Add a MatchAny matcher that emits `pact:matcher:combine: "OR"` so the
value matches if at least one of the matchers matches, and a
likeOrNull() shortcut (like + nullValue). MatchAll output is unchanged.

Requires a pact_ffi version shipping pact-foundation/pact-reference#601.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Consumer test runs against the mock server, proving both alternatives
match, non-matching values fail (body, header and query), and that the
pact file contains combine OR. Provider returns the null alternatives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…evert before merge)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant