Skip to main content

Pacts from mocks

Apiome can now write a consumer's pact from its calls to the hosted mock — no Pact library, no test rewrite — and serve published pacts back as a stub. Neither Pact Broker nor PactFlow does this. Start on Pact from a mock.

  • Capture for a consumer. Tag calls with X-Mock-Capture: <consumer>@<version>, or use a private capture URL, and the mock keeps them, redacted, as a capture session (Capture for a consumer).
  • A pact engine. Calls are grouped by operation, status and provider state; provider states come from the scenario or session behind each answer; values are matched exactly, by type or from the spec; chaos, off-spec and refused calls are left out with the reason.
  • Generate a pact from a mock. Contracts → Generate a pact from a mock records a session, reviews the pact — changes since the previous one first — and publishes it. It also builds pacts from past traffic and from operations × scenarios with no traffic at all.
  • From CI. apiome pact record -- npm test and the GitHub Action's record command wrap the consumer's tests; Keep it current from CI sets, per mock and consumer, when a build's pact is published and whether a pact that got looser is published with its owners told or held for review.
  • Only what was read, and other protocols. With the SDK's fieldUsage hook or the mock's browser recorder, a pact expects only the fields the consumer reads. GraphQL, gRPC and event-channel calls become GraphQL-over-HTTP, protobuf-plugin and message interactions.
  • Serve pacts as a mock. A hosted stub answers each request with what the selected pacts promise, each provider state a scenario, and falls back to the spec mock or a 501 (apiome pact stub).

Every apiome pact command in this set has a screen, and every screen shows the command (one model, every surface).