<#1065 Matchers not applied in the generated pact ...
# pact-js-development
g
#1065 Matchers not applied in the generated pact json file if response object keys contain forward slashes Issue created by shubhankard34 Software versionsOS: Mac OS 13.2.1 • Consumer Pact library: pact-foundation/pact 9.12.2 • Provider Pact library: pact-foundation/pact 9.12.2 • Node Version: 14.17.3 Issue Checklist Please confirm the following: ☐ I have upgraded to the latest ☐ I have the read the FAQs in the Readme ☐ I have triple checked, that there are no unhandled promises in my code and have read the section on intermittent test failures ☐ I have set my log level to debug and attached a log file showing the complete request/response cycle ☐ For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem Expected behaviour Consider this partial interaction:
Copy code
const interaction = {
    ...
    willRespondWith: {
        body: {
            ...
            'someInteger': integer(20)
        }
    }
}
The corresponding generated JSON file has matchers applied as follows:
Copy code
"response" {
    ...
    "body": {
        "someInteger": 20
    },
    "matchingRules": {
        "$.body.someInteger": {
            "match": "type"
          }
    }
}
But if the key includes a forward-slash (
/
) like so:
Copy code
const interaction = {
    ...
    willRespondWith: {
        body: {
            ...
            '/someInteger': integer(20)
        }
    }
}
The generated JSON doesn't contain
matchingRules
like so:
Copy code
"response" {
    ...
    "body": {
        "/someInteger": 20
    }
}
Steps to reproduce Use a matcher for a property of an object with key that includes a forward slash. pact-foundation/pact-js