Repository navigation
docs(adr): 0027 support Hey API as a third, opt-in generator stack - #133
Merged
Merged
Conversation
) Records the #124 spike outcome. Proposed: add `generator: "hey-api"` as an experimental, opt-in stack, with op-ID gate() and an `openapi-versions/hey-api` runtime entry; amends ADR 0017. Evidence is on branch try/hey-api (spike/hey-api/). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 12, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
4 tasks done
NoZiL
added a commit
that referenced
this pull request
Nov 13, 2026
## What and why Codegen half of ADR 0027: `generator: "hey-api"` runs `@hey-api/openapi-ts` 0.99.x on each major's merged spec. - **Output**: Hey API's files go in `v<n>/sdk/`, staged and renamed with the rest under the codegen lock (ADR 0021/0023). Imports are extensionless, there is no barrel, and an empty explicit config file means the app's own `openapi-ts.config.*` is not merged into our settings. - **Open enums**: `$resolvers.string` and `$resolvers.union` on `@hey-api/typescript`. Nullable ones work too, including 3.0 `nullable: true`. - **Gating data**: operation ids and export names are read back from Hey API's IR and symbol registry, never re-derived (e.g. `delete` → `delete_`). Codegen fails if an operation in `meta.ops` lacks an id, its sdk function or its TanStack helper, or if two re-exported functions share a name. `meta.ts` gains `opIds`, and `core.ts` / `gated.ts` split the functions into floor operations and newer ones. `client.ts` exposes them as `$api` / `$gated`. - **Auto-detection**: Hey API is tried last (decided in ADR 0027). - **Pruning**: each `v<n>` keeps a manifest (`.openapi-versions-files.json`) of what it wrote. The next run removes exactly what it wrote before and not now, for example after a `generator` change. Files codegen never wrote are kept. - `loadGenerator()` now returns `kind: "schema" | "sdk"`. The Hey API output types are exported from `openapi-versions/codegen`. **Don't release before #126.** The generated `client.ts` imports `openapi-versions/hey-api`, which #126 adds. Until then the fixture's `client.ts` is excluded from tsc (`tsconfig.json`, marked to drop in #126). Not in this PR: - "CI matrix type-checks the Hey API output on the supported TS range": there is no TS matrix for any stack yet, so this item goes to #70. I checked the output by hand on TS 5.4, 5.5, 6.0 and 7.0.2 during the #124 spike. - TanStack `xxxQueryKey` helpers are not re-exported. Hey API registers them without operation metadata, so finding them would mean re-deriving its names, which ADR 0027 rules out. I'll raise it in #126, where the client surface is designed. Review: two `/code-review high` passes on `origin/main...HEAD`. Fixed: app config leaking into Hey API, pruning that could delete the app's files (now manifest-based), the weak op/export check, empty `JobError` messages, a misleading `ENOENT` on unreadable specs, duplicate re-export names, and a quadratic lookup. Left for the maintainer: see the PR comment on auto-detection. Closes #125 ## Checklist - [x] `mise run check` passes (what CI runs) - [x] `pnpm changeset` added for any change to the published package (`.changeset/hey-api-generator.md`, minor) - [x] Generated output was not edited by hand (`playground/generated`, `test/fixtures/generated`) - [x] ADR added or superseded in `docs/adr/` if this touches a trigger in `AGENTS.md`: covered by ADR 0027 (#133), which this implements; the new optional peer is the range it sets 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
What and why
Records the outcome of the #124 spike as ADR 0027 (status: accepted after review).
Recommendation: support Hey API (
@hey-api/openapi-ts) as a third, opt-in, experimental stack. Don't replace either existing stack, because Hey API's calling style is different. It amends ADR 0017. ADR 0003 (gating) holds as written: the Hey API path keeps$api/$gated+gate()/<Feature>.Evidence: branch
try/hey-api(spike/hey-api/, not for merging), with the generated output committed.$resolverson@hey-api/typescript. Everyenum-shapesfixture matches openapi-typescript, and no helpers patch is needed.delete→delete_).gate()readsqueryKey[0]._id. X-Api-Version and Sunset come through a response interceptor.test/types.check.tstype-check on TS 5.4, 5.5, 6.0 and 7.0.2, and copies of thetest/react.test.tsxscenarios pass (6 tests).Risks in the ADR: 0.x with no stable release since 2026-06-22; TS 7 breaks generation on 0.99.0 (hey-api/hey-api#4235, fixed in
@next); two undocumented internals; output must go inv<n>/sdk/because of aclientname collision.Closes #124
Checklist
mise run checkpasses (what CI runs). Docs-only: ranpnpm lint; CI runs the restpnpm changesetadded for any change to the published package. Not needed: ADR only, same as docs(adr): 0017 support openapi-typescript and openapi-typesafe side by side #73 for ADR 0017playground/generated,test/fixtures/generated)docs/adr/if this touches a trigger inAGENTS.md🤖 Generated with Claude Code