> The example values should represent what the...
# libpact_ffi-users
t
The example values should represent what the matcher is matching. In the customer facing DSL, this should be validated.
If I understand correctly, this suggestion is quite opposite with this suggestion from Matt https://pact-foundation.slack.com/archives/C9VBGLUM9/p1690516277135829?thread_ts=1690472580.471449&cid=C9VBGLUM9
r
Yes, because the DSL layer (what is exposed to the user) has the context on what is trying to be done. The backend Rust API does not have that context, so how can it know whether one matcher is not the correct one to use with another generator.
If you have a DSL function
integer(100)
, you can know that the regex matcher
\d+
and RandomInt generator is correct, but the RandomDecimal one is not correct. The backend Rust functions won't know that the operation is about integers.
t
Because of regex validation, I can't register the
interaction #1
in v2/http-consumer.feature because of this exception (from pact-php):
The pattern \w{3}\d{3} is not valid for value a. Failed with error code 0. (PhpPact\Consumer\Matcher\Exception\InvalidRegexException)
I think the simple solution is to provide a way to disable regex validation during running compatibility suite
r
Is it just the example value that is not correct? Can we fix that in the suite, or is it a PHP issue?
If we change the regex to
\\w{1,3}\\d{0,3}
it should then work. There may be lots of other issues like that.
t
The problem is: I think compatibility suite is built with pact-rust in mind. This is one example. In pact-rust, we can simply set the regex matcher, no need to validate the value with it. In pact-php (and probably in other languages), we need to validate the value first before setting the regex matcher. I don't think updating
compatibility suite
is a good idea for now. Just add a simple condition to
pact-php
and call it a day.