pact-foundation / pact-go

Golang version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
http://pact.io
MIT License
836 stars 106 forks source link

UUID Matcher doesn't allow for specific example to be provided #266

Open will-banked opened 1 year ago

will-banked commented 1 year ago

Software versions

Expected behaviour

In pact-js the v3 UUID matcher will accept an example argument, and I'd like the same in pact-go as well, as we have some use cases where the UUID we need to use in the request to the provider is a specific one. I wondered if it was because I was using v2 matchers in Go vs v3 in JS, but definitely haven't seen a /v3/matchers module to use instead.

Actual behaviour

Currently the UUID matcher auto generates a random UUID in the example, with no option to provide a specific UUID unless you use a non-UUID matcher instead.

Steps to reproduce

Relatively self evident.

Relevent log files

Not required

mefellows commented 1 year ago

It should be noted, the current UUID matcher is just a regex (so you could just use a regex). I think the simplest option here is to create a new matcher UUIDv4(example string) that accepts an example, but uses the same regex.

What do you think?