refactor(sdk): keep clients' additional-types in their own generated … - #458
Merged
Conversation
josecarneiro
approved these changes
Aug 27, 2026
…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
force-pushed
the
fix/additional-types-sdk-improvements
branch
from
August 27, 2026 09:51
d9a88be to
f55e85f
Compare
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.
…file
e977ddb made the hand-written types a client declares in
src/additional-types.tsreach@epilot/sdk/<api>by appending them to the generatedsrc/types/<api>.d.ts. This changes the mechanism rather than the result: the generator now copies them to their ownsrc/types/<api>-additional.d.ts, rewriting the./openapiimport to the copied generated types, and re-exports that file fromsrc/apis/<api>.ts.Two reasons to split the file:
<api>.d.tsstays a faithful 1:1 copy of the client's generatedopenapi.d.ts, so future spec regenerations diff cleanly instead of mixing generated and hand-written declarations.export ... from './openapi'. The previous regex stripped only the firstimport type { ... } from './openapi';, so a client with a second such statement would have emitted an unresolvable./openapiimport.The public type surface is unchanged relative to main:
dist/apis/pricing.d.tsexports the same 185 names before and after,Cart,PriceTierEnhancedandAvailabilityDateamong them. Regenerating drops the block e977ddb appended totypes/pricing.d.tsand moves it — including that commit's correctedCart.statusdocblock — intotypes/pricing-additional.d.ts.Also adds a regression test, and the changeset e977ddb omitted: released
@epilot/sdk2.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