Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support combining matching rules #1203

Open
mefellows opened this issue Mar 27, 2024 · 0 comments
Open

Support combining matching rules #1203

mefellows opened this issue Mar 27, 2024 · 0 comments
Labels
enhancement Indicates new feature requests triage This issue is yet to be triaged by a maintainer

Comments

@mefellows
Copy link
Member

In some cases, you need to apply multiple matchers to a field in order to properly validate it. Only Pact JVM currently supports this behaviour.

The capability to combine matching rules will be enabled in the next release (v0.4.19), but the clients will need to update their DSLs to support it.

Motivating Use Case

From a request in slack.

How might you write a matcher to check both the keys and values and the same time (use eachKeyMatches and eachValueMatches simultaneously):

    enum Keys {
      One = "One",
      Two = "Two",
    }

    interface Value {
      min: number
      max: number
    }

    type R = Record<Keys, Value>
    const record: R  = {
      [Keys.One]:
        {
          min: 1,
          max: 2
        }
    }

  it("check record", async () => {
    messagePact
      .expectsToReceive("record")
      .withContent({
        // What need to write here to check type R ?
      })
  })

Proposed API to support this

TBC

Background: pact-foundation/pact-reference#399 (comment)

@mefellows mefellows added triage This issue is yet to be triaged by a maintainer enhancement Indicates new feature requests labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests triage This issue is yet to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant