Ashley Gautama
01/16/2025, 12:00 PMMatt (pactflow.io / pact-js / pact-go)
Ashley Gautama
01/16/2025, 12:32 PMAshley Gautama
01/16/2025, 12:32 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Ashley Gautama
01/16/2025, 12:34 PMMatt (pactflow.io / pact-js / pact-go)
Ashley Gautama
01/16/2025, 12:34 PMAshley Gautama
01/16/2025, 12:35 PMMatt (pactflow.io / pact-js / pact-go)
Ben Brugman
01/16/2025, 12:57 PMBen Brugman
01/16/2025, 1:00 PMYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Ben Brugman
01/16/2025, 3:11 PMYousaf Nabi (pactflow.io)
Boris
01/17/2025, 1:13 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
The consumer now knows from the contract the shape of the request and the response, and can verify if that request and response matches.
Cant the contract be used as a stub for the consumer?
It sounds really easy, so i feel like i am missing something why it can’t work.Let’s assume the consumer gets its hands on a contract (a pact file). It would be relatively trivial (in fact I think it’s possible it already exists in the core engine) to give a pact file to a mock server and ensure the consumer doesn’t make any calls to it that don’t align with it (actually, the current FFI method that supports this would fail unless all interactions are called, but this again should be straightforward to address). So far so good. The problem is we don’t know what field values are used (just the endpoints and variations on them, assuming the provider states are used). So that’s a downside. We would need a way to send results back up the chain, but that’s relatively easy. What I would want from this, is to possibly regenerate a Pact file that is specific to this consumer, so we now have a snapshot of what it needs (or perhaps that’s encoded in the consumer verification results, somehow). You could make this version support the next level of detail, by also making the consumer write Pact tests so we get the field-by-field fidelity (but this would obviously complicate the process, and probably reduce the benefit you’re looking for)
The provider creates the contract.how would it go about doing this? Are you expecting them to effectively write their own consumer tests against themselves and publish it?
Ashley Gautama
01/17/2025, 2:24 PMhow would it go about doing this? Are you expecting them to effectively write their own consumer tests against themselves and publish it?I suppose the provider could generate an openAPI spec from their source code (every time all their unit tests pass) Then it is a matter of converting that spec to the DSL Pact understands and publishing it
Matt (pactflow.io / pact-js / pact-go)
Ben Brugman
01/21/2025, 9:31 AM