/** * @hey-api/openapi-ts configuration. * * Reads the captured `openapi.json` (produced by scripts/generate-spec.ts) and * emits a tree-shakable TypeScript client + Zod schemas + types into * `src/generated/`. * * Run via: * pnpm --filter @toolctrl/api-client-ts generate * * The full pipeline (capture spec → generate client) is: * pnpm --filter @toolctrl/api-client-ts generate:all * * Refs: docs/improvement-plan/08-mobile-cli-storybook-sdk/ts-sdk.md */ import { defineConfig } from "@hey-api/openapi-ts"; /** * Note on plugin selection: * * The `zod` plugin is intentionally omitted. The latest @hey-api/openapi-ts * emits `z.iso.*`, `z.email()`, `z.int()`, and `z.url()` calls that require * zod v4, while the wider toolctrl workspace is pinned to zod v3 via * pnpm overrides. The generated TypeScript types and fetch SDK are * sufficient for the Higher-Level-Wrapper in `src/client.ts`, which performs * its own runtime validation policy (idempotency, retry) outside of zod. * * When the workspace migrates to zod v4 we can re-enable the plugin in a * follow-up commit. */ export default defineConfig({ input: "./openapi.json", output: { path: "./src/generated", format: "prettier", lint: false, }, plugins: ["@hey-api/typescript", "@hey-api/sdk", "@hey-api/client-fetch"], });