Skip to content

feat: OpenAPI docs with a Scalar reference at /docs - #41

Merged
leviFrosty merged 1 commit into
mainfrom
docs/api-doc-viewer
Oct 15, 2026
Merged

leviFrosty merged 1 commit into
mainfrom
docs/api-doc-viewer

Conversation

@leviFrosty

Copy link
Copy Markdown
Owner

Adds a public API reference: /docs (Scalar) rendering /openapi.json (OpenAPI 3.1), on prod and dev.

  • Every route carries a hono-openapi describeRoute, kept in an openapi.ts beside its handlers (src/notesImport/, src/buddies/, src/accounts/, src/routePlanning/, src/openapi/coreDocs.ts). Shared helpers, the error envelope, and shared error components live in src/openapi/schemas.ts.
  • Schemas describe the wire format; they don't validate. Handlers keep their own parsing, so a contract change means updating the route's openapi.ts in the same PR (noted in AGENTS.md).
  • src/openapi/openapi.test.ts fails on any undocumented route, or an operation without a tag, summary, or responses.
  • Signed Buddies/accounts ops document the {p, s} envelope and list the decoded p fields as a table.
  • The Hono app moves to src/app.ts so tests can read its route table; src/index.ts keeps Sentry, cron, and the DO exports. No runtime behavior changes.
  • Scalar's hosted AI agent, telemetry, and dev toolbar are off. The UI loads from jsDelivr. The spec is ~200 KB, built once per isolate.

Verified: tsc, 731 unit tests, wrangler deploy --dry-run (prod + dev, 582 KiB gzip), the verify loop (doctor, 38 e2e tests, fuzz:buddies 300 cases ok), and /docs rendered locally.

Doc writing turned up some contract drift between the code and docs/buddies-protocol.md (documented as the code behaves):

  • suspended (403) and unknown_account (404) are missing from the protocol's error table; live close code 4003 isn't listed either.
  • inbox/register also returns accountId once linked, and accepts the optional account proof.
  • A wrong claimSecret on invite/claim is 401 bad_signature.
  • The device/register row in the protocol's ops table is garbled.
  • Notes Import App Attest too_many_challenges (429) sends no Retry-After, unlike the shared envelope's promise.

🤖 Generated with Claude Code

Every route now carries a hono-openapi describeRoute, kept in an openapi.ts
beside its handlers. GET /openapi.json serves the generated OpenAPI 3.1
document and GET /docs renders it with Scalar, on prod and dev. A unit test
fails on any route without docs.

The Hono app moves from src/index.ts to src/app.ts so tests can read its
route table; index.ts keeps the Sentry wrapper, cron, and DO exports.
@leviFrosty
leviFrosty merged commit 461e140 into main Oct 15, 2026
1 check passed
leviFrosty added a commit that referenced this pull request Oct 16, 2026
- feat: account handoff relay and encrypted backups
- fix: keep the HERE key and queries out of Sentry spans
- perf: keep OpenRouter and serial KV reads off the status path
- feat: account/info for reading your own account
- feat: OpenAPI docs with a Scalar reference at /docs (#41)
- feat: add arabic to the shared contact page
- feat: self-host app updates on cloudflare
- fix: restore notes import on azure (#38)
- feat: read paper note pages for Notes Import
- feat: switch Notes Import to GPT-6 Luna on Azure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant