Repository navigation
Conversation
Ran every pact the FFI writes (pact-js 16 / pact_ffi 0.5.x) through the
schemas via the pact-msw-adapter golden harness. v4 rejected 17 valid
pacts, and v3 accepted some it shouldn't.
- eachKey / eachValue: rules are real matchers (was Unknown/FIXME),
value is optional and a JSON-encoded example (not a $-path), generator
allowed
- arrayContains: variants typed as {index, rules, generators?}
- statusCode: status is a class name or a list of codes
- Date / Time / DateTime generators: optional expression
- ProviderState generator: optional dataType
- body: contentTypeHint optional, pact_models omits it by default
- v4 only: plugin matchers and generators as an escape hatch for unknown
match/type values. Known types are excluded, so a malformed built-in
still fails instead of falling through to the plugin shape
- matchers / generators nested inside eachKey, eachValue and arrayContains
are referenced by $ref, so v3 stays v3 and v4 picks up v4 + plugins
Adds pass/fail examples for each of the above.
This was referenced Nov 27, 2026
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.
I wired these schemas into the pact-msw-adapter golden tests, which build
pacts through pact-js / pact_ffi and compare the rules against our own
matcher implementation. Running every FFI-written pact through the schemas
surfaced a few problems.
v4 rejected valid pacts (17 of the golden cases)
eachKey/eachValue:ruleswereUnknown[](FIXME).valuewasrequired and had to look like a
$path, but pact_models writes aJSON-encoded example and leaves it out when it's empty.
generatorwasn't allowed.
arrayContains:variantswereany[]. They're now typed as{index, rules, generators?}.statusCode:statuscan be a class name (success,clientErroretc.) or a list of codes, not just any string.
Date/Time/DateTimegenerators can carry anexpression.ProviderStategenerators can carry adataType.contentTypeHintis optional, and pact_models omits it by default.Plugin matchers/generators (v4 only)
Plugins can register their own match types and generators. These
serialise as
{match: <name>, ...}/{type: <name>, ...}, so v4 now hasmatchPlugin/genPluginas an escape hatch. Known type names areexcluded via
not: {enum: [...]}, so a malformed{match: "regex"}without a
regexstill fails rather than passing as a "plugin". v3doesn't get the escape hatch, and an unknown or v4 matcher in a v3 pact
still fails.
Nested rules
Matchers and generators nested under eachKey, eachValue and arrayContains
now
$ref#/definitions/matcher/#/definitions/generator, so eachversion's schema validates nested rules against its own set.
Pass/fail examples are added for each change. 372 tests pass.
Related: pact-foundation/pact-reference#613 stops the FFI from writing
v4-only rules into v3 pacts (and v3 into v2) in the first place.