HI all. I have a vary generic question: what is th...
# general
g
HI all. I have a vary generic question: what is the best practice for grouping interaction in contracts. To be more specific, if A is a consumer calling the endpoint of provider B, should all interaction go in a single contract of should they be split in multiple contracts? For example they might be split by feature, or on a subset of the path or maybe a contract for each endpoint? What I am really asking: for the pair A/B should a single contract be published by A or multiple contracts are the best way?
b
I don't think there is a way (or at least I'm not aware of it) to generate multiple contracts for the same integration of consumer A and provider B. And that's a good thing I think. Of course, you can distribute your consumer tests over multiple classes or modules, but the interactions will end up in the same contract as long as the consumer and provider identification is the same. Different identifiers => different contracts, and Pact will essentially treat them as completely separate consumers or providers. Why would you want to separate them into multiple contracts?
☝️ 1
g
Thanks you. Intuitively it makes sense to have a single contract file for each pair consumer/provider. I was just wondering if my intuition was right.
1
b
Well I think it is :)
1