feat: add support for arrayContains matcher#131
Merged
surpher merged 1 commit intoJul 16, 2026
Conversation
pepejeria
force-pushed
the
feat/array-contains-matcher
branch
3 times, most recently
from
July 14, 2026 11:43
4505ab0 to
6fc44e8
Compare
pepejeria
force-pushed
the
feat/array-contains-matcher
branch
from
July 14, 2026 11:46
6fc44e8 to
70690c5
Compare
surpher
approved these changes
Jul 16, 2026
Owner
|
Thank you for this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary of Changes
Adds support for the Pact v4
arrayContainsmatcher.An
arrayContainsmatcher checks that an array contains at least one element matching each of the provided variants, in any order (extra elements are allowed).Changes:
Sources/Matchers/ArrayContainsMatcher.swift(new):ArrayContainsMatcher— serialises to the integration JSON the Pact FFI expects:{ "pact:matcher:type": "arrayContains", "variants": [ … ] }.ObjectMatcher— encodes a[String: AnyMatcher]variant as a plain JSON object (so nested matchers are extracted per-variant by the core).Sources/Matchers/Matcher+V4.swift:// TODO: "arrayContains"with twoarrayContains(_:)overloads (object variants and generalAnyMatchervariants).Tests/Matchers/MatcherArrayContainsTests.swift(new): serialisation tests (object variants, scalar variants, empty).GenericMatcherbecause the JSON shape differs:arrayContainshas a top-levelvariantsarray and novaluefield, whereasGenericMatcheralways emitsvalueand has novariantskey.pact-foundation/pact-reference,pact_ffi/src/mock_server/bodies.rs).🧐🗒 Reviewer Notes
💁 Example
🔨 How To Test
Run tests :)