ITV / scala-pact

A Scala implementation of CDC using the Pact standard
Other
108 stars 54 forks source link

matching on path #186

Open Liorba opened 3 years ago

Liorba commented 3 years ago

hello, I'm wondering if it possible to add matching rules on path/uri. for example, I a provider service which accept GET request with id in the path foo/bar/:id I want the stubbed server to ignore the actual id I send from my consumer service. I saw that currently there is only matching rule on body and headers, but not on path although the pact v3 spec allows that. I tried to add a custom rule to my "interaction" in the form of Some(List(ScalaPactMatchingRuleRegex("$.path", "/foo/bar/\\d+"))) but id didn't work.

if this is indeed possible, I would love your help on who to achieve this Thanks!

jbwheatley commented 3 years ago

Hi @Liorba. Path matching as you've described isn't supported by scala-pact, as we currently follow the v2 pact spec where paths must be an exact string match. I would suggest using some dummy id for all of you test cases instead.

jbwheatley commented 3 years ago

Addendum: support could be added as part of the "non-strict" matching flow (which doesn't conform completely to the pace spec) 

Liorba commented 3 years ago

Thanks for your answer @jbwheatley. when are you planning to add the support for v3?

jbwheatley commented 3 years ago

I'm afraid it's not even on my radar at the moment. Its mainly just me actively maintaining things and my current focus is on slowly adding support for all the v2 features we are currently missing.