Files
zpan/cmd/internal/openapi
Jasper VanandClaude Opus 4.8 e132cb9e41 feat(openapi): complete API coverage with truthful schemas + unified error handling (#442)
* feat(openapi): complete API coverage with truthful schemas + unified error handling

Migrate every resource router to `@hono/zod-openapi` so the global OpenAPI
document (and the SDKs generated from it) covers the whole product API, not just
~15% of it. The document now describes 25 resources with named component schemas,
operationIds, and accurate response shapes.

What changed:
- Unified error handling: a single `mapDomainError` (DownloadError, ObjectUpload-
  SessionError, NameConflictError, StorageQuotaExceededError, BackgroundJobError,
  WebDavPathError) wired into a global `app.onError`; handlers throw domain errors
  instead of hand-rolling per-route try/catch. One shared `ErrorResponse` envelope.
- Shared http helpers (`server/http/openapi.ts`): generic `jsonContent`/`jsonBody`/
  `errorResponse` so the precise schema type reaches `createRoute` — typing
  `c.req.valid()` and strictly checking `c.json()` returns (no widened `z.ZodType`).
- Schemas are the truth: response schemas are named (`.openapi('X')`), wire-shaped
  (ISO-string timestamps via per-resource `toXDTO` mappers where the domain type
  uses `Date`), and strictly enforced against handler returns. The strict pass
  surfaced and fixed several latent schema lies (e.g. transfer result shape,
  download-task delete tombstone, object `purged`).
- operationId + summary on every route → clean SDK method names.
- Curated out of the public SDK (kept as plain routes): the `/r` redirect resolver,
  store webhook receiver, internal telemetry endpoint, the PicGo/ShareX image
  upload tool endpoint, the share download redirect, and cron-secret licensing
  sync endpoints.
- Disambiguated user operationIds that collided with better-auth's admin API;
  dropped `additionalProperties` schemas that oapi-codegen mis-generates.
- Regenerated the Go downloader client and realigned its hand-written wrapper to
  the operationId-derived names.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* style(cmd): gofmt the realigned downloader client

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 11:12:08 -04:00
..