Skip to content

feat: add any_of and nullable matchers combining rules with OR - #5

Draft
YOU54F wants to merge 3 commits into
mainfrom
feat/or-matcher
Draft

YOU54F wants to merge 3 commits into
mainfrom
feat/or-matcher

Conversation

@YOU54F

@YOU54F YOU54F commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Summary

Adds match.any_of(...), the | operator between matchers, and match.nullable(...) to pact.match, emitted as integration JSON with "pact:matcher:combine": "OR". Includes docs in docs/consumer.md and tests/test_match_or.py, which covers serialisation and mock server matching.

Testing

tests/test_match_or.py (30 tests) passed locally against a pact_ffi build with pact-foundation#601.

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 3 commits November 9, 2026 18:54
Add `OrMatcher`, which combines matchers with a logical OR using the
`pact:matcher:combine` integration JSON attribute. It is available via
`match.any_of(...)`, the `|` operator, and `match.nullable(...)` for the
common value-or-null case. Nested OR matchers are flattened into a single
list of alternatives, and AND/OR cannot be mixed at the same path.

Only the example value is exercised in the consumer test. Requires a
pact_ffi with pact-reference#601 (TODO: minimum version).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Points the FFI build hook at the YOU54F/pact-reference prerelease, and
lets test_version accept the -rc.1 suffix in pactffi_version().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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