Rachel Butler
10/25/2022, 3:32 PMError from Pactflow stub: Pact::Error - Value to generate \"[\"string\"]\" does not match regular expression /[A-Za-z0-9]{1,}/
For reference, we have tried both of the two ways (one including a custom example, and the other not):
// Example not included (Pactflow generates randomly)
pactDslRequestWithPath = pactDslRequestWithPath.matchQuery(parameter.getName(), "[A-Za-z0-9]{1,}");
// Example included
pactDslRequestWithPath = pactDslRequestWithPath.matchQuery(parameter.getName(), "[A-Za-z0-9]{1,}", "string");
Here is the relevant part of the contract that was generated:
"request": {
"method": "GET",
"path": "<path>",
"query": "response_type=string&client_id=string&redirect_uri=string&state=string&scope=string",
"matchingRules": {
<path>,
"$.query.response_type": {
"match": "regex",
"regex": "[A-Za-z0-9]{1,}"
},
"$.query.client_id": {
"match": "regex",
"regex": "[A-Za-z0-9]{1,}"
},
...
}
We were facing similar issues with machPath() when we were not including the example, but including the custom example worked in that case.
Has anyone got this feature working with v2 contracts? Am I missing something?