Skip to content

Emit OpenAPI paths from the handler derivation + bearer securityScheme #860

Closed

Description

@athvin

API product implementation work · roadmap #1008 · use parent dependency order; not a separate product rank.

Part of #857. Stack rank 3 of 13. Depends on: T2 (consumes er-api-spec), T1 (references wire-struct schemas).

Color

The document finally describes operations — derived from the handler source, per the house decision written in both test headers: "a #[utoipa::path] response body, or any hand-maintained table, is one more claim that can drift from the code." Every routed handler already carries a doc comment shaped Role: summary (`METHOD /path`), and a handler the derivation cannot classify is a hard failure, not a skip. This ticket also adds the bearer securityScheme (the erk_… token format) — the first half of "a user sets up their own connection", and what makes Swagger UI's Authorize button work later.

Scope

  • er-server/src/openapi.rs builds the document programmatically (utoipa 6's PathsBuilder/OperationBuilder over er_api_spec::routes(include_str!("lib.rs"))): per route — summary, path parameters, a security requirement naming the required role, request body ($ref to the entity wire schema where the body type is an entity, derived inline schema otherwise), and responses at envelope granularity plus the {"detail": …} error body (a real contract — the BFF parses it).
  • Register the bearer security scheme in components.securitySchemes.
  • Regenerate openapi.json + schema.d.ts (snapshot test + CI byte-compare pin both).
  • Skills in this PR: rewrite api-contract's "What is generated and not yet consumed → No path is described" section — it becomes false here.

Out of scope

Audience filtering / public document (T4). Typed response bodies (T7). Query parameters (T8).

Testing

  • Snapshot test updated; a derivation-floor test (paths count > 80 — same pattern as the existing > 40 tool floor).
  • schema.d.ts's paths type is no longer Record<string, never>.
  • Spot-assert one route per envelope class (bare, wrapped, record, page, scalar, arrow) against envelopes.json.
  • make check + cd frontend && pnpm gen:api committed in the same PR.

Definition of done

Epic DoD, plus: every non-/v1/internal route present in the document with role, params and summary; the bearer scheme declared; the api-contract skill no longer claims zero paths.

Activity

  1. added
    rust
    mvp
    on Nov 8, 2026
  2. self-assigned this
    on Nov 9, 2026
  3. athvin commented on Nov 9, 2026

    @athvin
    OwnerAuthor

    Claimed — working in #1063 (draft), 2026-11-09T20:44:41Z. Closing that PR releases the claim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

mvprust

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions