Generate a pact from a consumer's mock calls
A consumer's calls to the hosted mock can now become its pact. Record them as a capture session
with X-Mock-Capture, then POST …/pact-broker/pacts/generate with the session. You get a Pact v4
document, ready to publish, and a report that explains every part of it. See
Pact from a mock.
- One interaction per operation, status and state. Calls to
/invoices/42,/43and/107become one interaction, with the path matched by the spec's parameter shape. Calls injected by chaos mode, calls not in the spec and requests the mock refused are left out. Each one is listed with its reason. - Provider states for free. A scenario answer is in the scenario's state, and a stateful
session answer is in
a resource exists at /invoices/{id}. The path parameters are the state'sparams. - Three ways to match.
exactkeeps the first call's values.typeaccepts any value of the same type.specalso applies the spec's formats, patterns and integers. A field is expected only when every response had it, and anything left out says why. - Redaction kept. A value the mock's redaction rules removed is restored from the spec's example, with a type match, or left out.
- Per-field overrides. Set a field to
uuid,datetime,regexand more, or leave it out. Each override reports where it applied and why it did not. - Checked and compared. The report compares the pact with the mocked spec revision. It also lists what changed since the consumer's previous pact, and flags a pact that got looser.
Nothing is stored until you publish. The page to record, review and publish from the UI, and
apiome pact record for CI, come next.
