Skip to content

test(compat): compatibility suite scenarios for matching rules combined with OR - #30

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

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

Conversation

@YOU54F

@YOU54F YOU54F commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Draft, stacked. This includes the commits from #28 (engine) and #29 (FFI). Only the compat-scenarios commit is new here. The scenarios are also raised against the suite as YOU54F/pact-compatibility-suite#4.

Commits

feat(ffi): support pact:matcher:combine OR in integration JSON

Matchers in integration JSON can now be combined with OR using the
pact:matcher:combine attribute. The rules are written to the pact file as
an existing rule list combined with OR, so the pact file format is unchanged.

fix(ffi): replace existing rules when integration JSON combines a path's rules with different logic

add_rule_list_to_category used to append OR rules to an existing AND list (or the
reverse), silently changing how the existing rules are combined. Rules with a
different logic now replace the existing ones with a warning, as Pact-JVM's
or DSL does, and rules with the same logic are appended.

fix(matching): support rules combined with OR in the V2 matching engine

  • The or action folded its results from OK, so it never failed. It now
    folds from the first child result.
  • Errors from the branches of a successful or are no longer reported as
    mismatches.
  • An object with rules combined with OR that include a null matcher now
    accepts a null value, and only checks the object's entries when the
    value is not null (new json:not-null action).

test(compat): add compatibility suite scenarios for matching rules combined with OR

docs(ffi): document nullable objects, wrapped matchers and invalid values for pact:matcher:combine

  • The combine value is not case-sensitive, and an invalid value writes null.
  • Rules inside an object value still apply to its children (null-or-object).
  • An OR matcher whose value is another matcher replaces that matcher's rules,
    with a warning, as Pact-JVM's or matcher does.
  • Remove the V2 matching engine limitation, now that it supports OR.

🤖 Generated with Claude Code

Sergey Shtubey and others added 5 commits November 9, 2026 12:13
Matchers in integration JSON can now be combined with OR using the
`pact:matcher:combine` attribute. The rules are written to the pact file as
an existing rule list combined with OR, so the pact file format is unchanged.
…h's rules with different logic

add_rule_list_to_category used to append OR rules to an existing AND list (or the
reverse), silently changing how the existing rules are combined. Rules with a
different logic now replace the existing ones with a warning, as Pact-JVM's
`or` DSL does, and rules with the same logic are appended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The `or` action folded its results from OK, so it never failed. It now
  folds from the first child result.
* Errors from the branches of a successful `or` are no longer reported as
  mismatches.
* An object with rules combined with OR that include a null matcher now
  accepts a null value, and only checks the object's entries when the
  value is not null (new `json:not-null` action).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mbined with OR

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lues for pact:matcher:combine

* The combine value is not case-sensitive, and an invalid value writes null.
* Rules inside an object value still apply to its children (null-or-object).
* An OR matcher whose value is another matcher replaces that matcher's rules,
  with a warning, as Pact-JVM's or matcher does.
* Remove the V2 matching engine limitation, now that it supports OR.

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