Rachel Butler
10/25/2022, 2:58 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?uglyog
Value to generate \"[\"string\"]\" does not match regular expression /[A-Za-z0-9]{1,}/
, the value has square brackets and quotes around it. That is why it is not matching the regexRachel Butler
10/25/2022, 11:31 PMuglyog
uglyog
Rachel Butler
10/26/2022, 12:57 PMRachel Butler
10/27/2022, 2:23 PMuglyog
Yousaf Nabi (pactflow.io)
Rachel Butler
10/28/2022, 4:18 PMMatt (pactflow.io / pact-js / pact-go)