Skip to content

refactor(sdk): keep clients' additional-types in their own generated … - #458

Merged
jnmau merged 2 commits into
mainfrom
fix/additional-types-sdk-improvements
Aug 27, 2026
Merged

refactor(sdk): keep clients' additional-types in their own generated …#458
jnmau merged 2 commits into
mainfrom
fix/additional-types-sdk-improvements

Conversation

@jnmau

@jnmau jnmau commented Aug 27, 2026

Copy link
Copy Markdown
Member

…file

e977ddb made the hand-written types a client declares in src/additional-types.ts reach @epilot/sdk/<api> by appending them to the generated src/types/<api>.d.ts. This changes the mechanism rather than the result: the generator now copies them to their own src/types/<api>-additional.d.ts, rewriting the ./openapi import to the copied generated types, and re-exports that file from src/apis/<api>.ts.

Two reasons to split the file:

  • <api>.d.ts stays a faithful 1:1 copy of the client's generated openapi.d.ts, so future spec regenerations diff cleanly instead of mixing generated and hand-written declarations.
  • The import rewrite is global and also matches export ... from './openapi'. The previous regex stripped only the first import type { ... } from './openapi';, so a client with a second such statement would have emitted an unresolvable ./openapi import.

The public type surface is unchanged relative to main: dist/apis/pricing.d.ts exports the same 185 names before and after, Cart, PriceTierEnhanced and AvailabilityDate among them. Regenerating drops the block e977ddb appended to types/pricing.d.ts and moves it — including that commit's corrected Cart.status docblock — into types/pricing-additional.d.ts.

Also adds a regression test, and the changeset e977ddb omitted: released @epilot/sdk 2.19.2 contains none of these types, so the next release exposes them for the first time and its changelog should say so.

Claude-Session: https://claude.ai/code/session_01JEMqupBjKVAzXWYDJvrdJc

@jnmau
jnmau requested a review from josecarneiro August 27, 2026 09:39
jnmau and others added 2 commits August 27, 2026 11:43
…file

e977ddb made the hand-written types a client declares in
`src/additional-types.ts` reach `@epilot/sdk/<api>` by appending them to the
generated `src/types/<api>.d.ts`. This changes the mechanism rather than the
result: the generator now copies them to their own
`src/types/<api>-additional.d.ts`, rewriting the `./openapi` import to the
copied generated types, and re-exports that file from `src/apis/<api>.ts`.

Two reasons to split the file:

- `<api>.d.ts` stays a faithful 1:1 copy of the client's generated
  `openapi.d.ts`, so future spec regenerations diff cleanly instead of mixing
  generated and hand-written declarations.
- The import rewrite is global and also matches `export ... from './openapi'`.
  The previous regex stripped only the first
  `import type { ... } from './openapi';`, so a client with a second such
  statement would have emitted an unresolvable `./openapi` import.

The public type surface is unchanged relative to main: `dist/apis/pricing.d.ts`
exports the same 185 names before and after, `Cart`, `PriceTierEnhanced` and
`AvailabilityDate` among them. Regenerating drops the block e977ddb appended
to `types/pricing.d.ts` and moves it — including that commit's corrected
`Cart.status` docblock — into `types/pricing-additional.d.ts`.

Also adds a regression test asserting every client's `additional-types.ts` is
copied and re-exported, so this cannot silently regress again.

No changeset: `@epilot/sdk` releases are driven by the `auto-release` job in
ci.yml, which bumps `packages/epilot-sdk-v2/package.json` directly and does not
consult changesets, so one here would have no effect on publishing.

Co-Authored-By: Viljami <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JEMqupBjKVAzXWYDJvrdJc
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Manual bump, because the `auto-release` job in ci.yml only fires when a commit
touches `clients/*/openapi.json`. This release carries changes that never touch
a spec, so it cannot release itself:

- e977ddb first exposed the clients' hand-written `additional-types.ts`
  through `@epilot/sdk/<api>`. Its merge (9e30439) touched no `openapi.json`,
  so it never published — `main` and npm have both sat at 2.19.2 since, with
  `Cart`, `PriceTierEnhanced` and `AvailabilityDate` still missing from the
  published `@epilot/sdk/pricing`.
- The preceding commit moves those types into their own generated file.

Publishing is driven by the `publish-sdk` job, which runs on a `@epilot/sdk@*`
tag, so this needs tag `@epilot/[email protected]` pushed once it is on main.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@jnmau
jnmau force-pushed the fix/additional-types-sdk-improvements branch from d9a88be to f55e85f Compare August 27, 2026 09:51
@jnmau
jnmau merged commit 56e9c02 into main Aug 27, 2026
7 checks passed
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.

2 participants