← ExamplesGitHub
EXAMPLE / REST

A bounded REST service.

Assume an Order Service owns order state and exposes an HTTP API to a Checkout Service.

Domain

Commerce order management.

Boundary

  • Owns: order lifecycle and order state.
  • May decide: whether an order transition is valid.
  • Exposes: order commands and queries.
  • Consumes: only explicitly named upstream identity or payment contracts.
  • Must not assume: callers can directly mutate order persistence.

Contract

POST /orders/{id}/confirm
Input: order confirmation command
Success: 200 with current order representation
Errors: 404 unknown order; 409 invalid transition; 422 invalid input
Timeout: 2s
Compatibility: additive response fields are tolerated; breaking changes require a new contract version

Execution

The service implementation can evolve internally without requiring consumer changes while the published contract remains satisfied.

Verification

  • Schema validation for request and response.
  • Provider contract tests for status codes and error semantics.
  • Consumer tests against the published contract.
  • CI gate for backward-incompatible contract changes.
Boundary signal: if a consumer starts depending on an internal order table or undocumented transition, that dependency is outside the stated contract and should be made explicit or removed.