ADR 0007: OpenAPI Governance and Usability Standard

Ratification

Adopted before ADR 0018. There was no separate ratification process. Git history for this file on main is the record.

Context

Why this matters: OpenAPI is not only a human-readable page — it is the contract that clients and tests use. Thin examples, missing error shapes, and missing headers push integrators to read code or guess. That does not scale and costs support time.

We already had docs; the gap was quality and consistency: full validation examples, links between related operations, snapshot tests so the contract cannot drift quietly, and CI that treats the spec like application code.

Decision

We use an OpenAPI governance standard: strict operation metadata, complete examples for errors and writes, response links where workflows exist, and automated contract checks in the pipeline.

Scope

Alternatives considered

  1. Keep current docs and improve ad-hoc.
    • Pros: no process overhead.
    • Cons: quality drifts over time; no consistent consumer experience.
  2. Adopt strict OpenAPI governance baseline (selected).
    • Pros: predictable contracts, safer integrations, easier onboarding, scalable docs maintenance.
    • Cons: requires discipline and CI investment.

Consequences

Positive

Trade-offs

Standard requirements

Implementation plan

  1. Phase 1 (implemented): improve user endpoints with complete 422 examples, links, operation IDs, code samples, and read-after-write flow.
  2. Phase 2: add shared components.responses and reusable error definitions across routers.
  3. Phase 3: enforce OpenAPI linting (Spectral) and contract diff checks in CI/pre-deploy gates.
  4. Phase 3.1 (implemented): add strict snapshot contract test against accepted OpenAPI baseline.
  5. Phase 4: expand code samples and external docs links for operational recovery/runbooks.

Validation

References

Page history

Date Change Author
Added Page history section (repository baseline). Ivan Boyarkin