API Reference
This service publishes three machine-readable contracts, all linted in CI by Spectral on every push and pull request:
| Contract | File | Rendered here |
|---|---|---|
REST (OLTP, cmd/wes) — OpenAPI 3.0.3 | apis/openapi.yaml | REST API — generated from the spec, not hand-transcribed |
Reports REST (cmd/wes-reports) — OpenAPI 3.0.3 | apis/openapi-reports.yaml | Reports API — generated from the spec (ADR-0038) |
| Events — AsyncAPI 2.6.0 | apis/asyncapi.yaml | Events |
The reports binary is a separate process on a separate port (:8092) against
the analytical database, so its three routes (GET /reports/throughput,
GET /reports/throughput/freshness, GET /healthz) have their own spec.
internal/adapters/inbound/http/reports_contract_test.go fails when the
reports router and that spec disagree on a route or a response shape.
Endpoint coverage: 14 operations
Every route registered in internal/adapters/inbound/http/router.go is
documented in apis/openapi.yaml, and therefore appears in the generated
reference — including GET /readyz, the readiness probe that flips to
not-ready first on graceful shutdown
(ADR-0023).
| # | Method | Path | Use case | OpenAPI operationId |
|---|---|---|---|---|
| 1 | POST | /paths/{pathId}/charge | — (removed in ADR-0049 stage E after one release of 410 charge-forecast-moved; answers 404, ADR-0049) | — |
| 2 | POST | /paths/{pathId}/plan | — (removed in ADR-0049 stage E after one release of 410 shift-plan-moved; answers 404) | — |
| 3 | POST | /paths/{pathId}/work-units | EnqueueWorkUnit | enqueueWorkUnit |
| 4 | POST | /paths/{pathId}/work-releases | ReleaseNextWork | releaseNextWork |
| 5 | POST | /work-units/{id}/completions | RecordCompletion | recordCompletion |
| 6 | GET | /paths/{pathId}/telemetry | SampleBacklog | sampleBacklog |
| 7 | POST | /paths/{pathId}/rebalance-decisions | RebalanceDecision | rebalanceDecision |
| 8 | GET | /paths/{pathId}/labor-plan-view | LaborPlanView (projection) | getLaborPlanView |
| 9 | GET | /inventory-view/{sku} | InventoryView (projection) | getInventoryView |
| 10 | GET | /work-units?reference= | GetWorkUnitsByReference | getWorkUnitsByReference |
| 11 | GET | /work-units/{id} | GetWorkUnit | getWorkUnit |
| 12 | GET | /healthz | — | healthCheck |
| 13 | GET | /readyz | — | readinessCheck |
| 14 | PUT | /paths/{pathId}/pool | ConfigurePool (ADR-0034) | configurePool |
Design constraints
- Richardson Maturity Level 2, deliberately. Resource nouns, correct verbs, correct status codes — and no hypermedia controls. Level 3 was not attempted; saying so in the spec's own description is more useful than leaving readers to infer it.
- All errors are RFC 7807
application/problem+json. See Error model. - Domain structs never leak. Every request and response is a DTO defined in
the HTTP adapter (
dto.go). Field names arecamelCaseon the wire; timestamps are RFC 3339. POST /paths/{pathId}/work-releasesis a POST on a sub-resource, notGET .../next, because releasing mutates the pool: an entry transitions toReleasedand can never be handed out again.
Two POSTs that are not creations
/paths/{pathId}/work-releases and /work-units/{id}/completions are transition
resources (ADR-0047): POST because they are state transitions, not because they
create a resource. Like every POST they are idempotent through Idempotency-Key.
Both return the affected representation with 200, not 201 — there is no new
URI to point a Location header at.
The creation endpoint (/work-units) does return 201 with a Location
header. The two moved planning routes answered 410 for one release and were removed in stage E (ADR-0049).