refactor: Upload extractor, 429 refusal test, stricter contract test

This commit is contained in:
2026-10-25 21:59:31 +01:00
parent c8d9138349
commit 2ac1d4e0cf
10 changed files with 139 additions and 52 deletions

View File

@@ -10,7 +10,7 @@ feature, ADR-0009). `router.rs` assembles them; handlers reach use cases only th
A JSON client previously met several failure bodies: `{"error": "..."}` from `ApiError`, bare
status codes with empty bodies from handlers that returned `StatusCode::NOT_FOUND`, plain text from
`domain_error_response`, axum's plain-text rejections for malformed `Json`/`Query`/`Path`, and the
rate limiter's own 429 text. None of the refusals appeared in the OpenAPI document.
rate limiter's own 429 text. The refusals were documented without a body schema.
## Decision
@@ -37,6 +37,9 @@ HTML and ActivityPub limiters keep axum-governor's default response.
pages), redirects and statuses. ActivityPub-facing routes keep their status-only errors. Only JSON
responses were unified.
**Not covered.** Unmatched `/api/v1` paths (404) and wrong methods (405) are produced by the router
itself and still return axum's empty bodies.
**The spec says so.** Every operation documents at least one 4xx, every authenticated operation
documents 401, and every 4xx/5xx references `ErrorResponse`. `tests/openapi_contract_test.rs`
builds the spec from `http_axum::openapi::spec()` (no bootstrap) and fails when a new endpoint