Create a postman collection from a pact
closed
Matt Fellows
closed
As noted the tool (https://www.npmjs.com/package/pmpact) exists.
Yousaf Nabi
This exists :) https://github.com/ITV/pmpact I've used it for a while and it is great.
Would love to get peoples thoughts
Matt Fellows
Yes!
To be able to do that, we'd need to be able to know which contracts to pull together that form the cohesive postman collection - i.e. THE provider interface (not just one consumer's expectations of it).
This is one of the benefits of the new environments/branches/releases feature, because we can nominate important environments / branches (e.g.
prod
and main
) and produce an external artifact that contains the union of all of the underlying contractsTim Jones
Matt Fellows: Why not just all of them?
Matt Fellows
Tim Jones: What does "all" of them mean? All by a particular tag? There will be a lot of junk and work-in-progress expectations by consumers that aren't likely to be useful. If the purpose is to have a postman collection that represents something useful, we need to know how to fetch the "useful" ones. Tag would be the best starting point, but knowing "this is the production collection" and "this is the current staging collection" seems more useful to me.
Tim Jones
Matt Fellows: All from a particular version. For a consumer, it's the whole pact (because you know that if it's in the contract, it's correct for the consumer). For a provider, it's every contract that is successfully verified for that version.
Tim Jones
Tags are a temporary layer of indirection to a version, so I feel like it has less meaning in the postman collection. You wouldn't want
consumerX-providerY-postman-prod
as the downloaded file name, because that's going to be out of date at some point.Matt Fellows
Tim Jones: I see the problem - think we're talking across points now that I think about it. You're asking for a single pact to be converted - I'm saying it would be helpful to producd the collection from the perspective of the provider. That is, multiple pacts representating all of its consumers.
In your case I agree.
Tim Jones
Matt Fellows: No, not exactly - for a consumer, it would be all the pacts that consumer has produced at that version (could be multiple providers). This is fine because you can't make a pact unless it passes the tests.
For a provider, it would be the same (all the pacts verified for that version of the provider).
(and for services that are both consumer and providers, you would just join both together)
> If the purpose is to have a postman collection that represents something useful, we need to know how to fetch the "useful" ones.
"useful" in this context is "everything that we expect to work". The use cases I've seen where having this feature would be useful are all from a version.
Dmitry Munda
awesome idea, but there are many REST clients. How about just curl-s ?
Mishal Alexander
Dmitry Munda: that would work too.