Repository navigation
feat(api): The OpenAPI document describes every response (#365) - #380
Merged
Merged
Conversation
Every route declares its success bodies and errors. RequireUser, RequireAdmin and RequireRateLimit declare the 401, 403 and 429 they cause, once per group where the group carries the requirement. Errors that had no body (challenge 401, policy 403, NotFound, Conflict, binding 400/415, the 501 stubs) are now Problem Details through UseStatusCodePages, and a Finally convention describes them that way. The proxy's 416 keeps its empty body and is declared so. Login and refresh return a named TokenResponse, the problem schemas carry the code extension, and the work-item and proxy-sweep validation problems get codes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The must-change-password middleware lets anonymous endpoints through, so sign-in and refresh never answer the 403 the document leaves out for them. RequireUser sits on the Media, Flashbacks and Bursts groups, and the tests share one invalid-field assertion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it causes (#365) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #365
Summary
Every operation in
docs/openapi/v1.jsonnow lists every status it can return, each with its body schema.Program.cs app.UseForwardedHeaders(); +app.UseApiProblems(); # exception handler → problem 500; under /api, bodiless 401/403/404/409/400/415/501 → problem bodyDecided in session, beyond #365's text:
{ error }sites). The proxy's 416 keeps the empty body the framework writes and is declaredProducesWithoutBody.AllowAnonymousendpoints, so sign-in and refresh never answer the 403 their operations leave out. refactor(api): Must change password is an authorization requirement #366 inherits that; its marker belongs inRequireUserAllowedWhileMustChangePassword.Also: named
TokenResponse(was anonymous), acodeproperty in the problem schemas, and codes for the work-item and proxy-sweep validation problems (#365 comment).Wire changes for clients (nothing is deployed):
application/problem+jsonbodies.errorsvalues are codes (invalid_page,invalid_page_size,pending_or_outcome,orphan_ids_or_all,invalid_orphan_count,unknown_orphans); the English text moved todetail. The field keyOrphanIdsis noworphanIds.Evidence
v1.jsonwas"200": { "description": "OK" }with no schema.After:
ApiDocumentTests.Operation_DescribesEveryResponseItCanGivepins a literal status → schema row for each of the 29 operations (failed 28/29 before the change).Responses_CoverEveryOperationfails when a route has no row.RouteTableTests: a route with no responses of its own fails (shown failing on an undeclaredGET /users), and so does a protected route without 401 or a rate-limited route without 429 (shown failing on a bareRequireAuthorization()).AuthenticatedTestApp, now with problem details, status code pages and the exception handler): 400/401/403/404/412/415/500/501 come back as problem+json; 416 has no body; the token JSON is exact (refreshTokenonly for mobile).EndpointResponsesTests), added only to kill aLast()mutant the document seam can't reach.scripts/mutation-changed.sh: 100.00% on every changed API file.scripts/derive-openapi.sh --check: current.Merge Danger
Door: two-way
Blast Radius: API error bodies
All error responses change shape, which matters for the UI client (#345, not built yet) and the native app. Merged with #359:
UseApiProblemsscopes the status code pages to/api, so UI asset 404s keep the empty bodyui-serving.mdspecifies (the UI serving tests now run behind it). #340 must update the proxy path's row inApiDocumentTests.🤖 Generated with Claude Code