Skip to content

feat(openapi): bundle latest spec (2026-03-25.dahlia) as filesystem fallback#207

Merged
kdhillon-stripe merged 1 commit intov2from
kdhillon/bundled-openapi-spec
Mar 30, 2026
Merged

feat(openapi): bundle latest spec (2026-03-25.dahlia) as filesystem fallback#207
kdhillon-stripe merged 1 commit intov2from
kdhillon/bundled-openapi-spec

Conversation

@kdhillon-stripe
Copy link
Copy Markdown
Collaborator

Summary

  • Bundles openapi.spec3.sdk.json (version 2026-03-25.dahlia) directly into packages/openapi/ as bundled-spec.json
  • When the requested API version matches the bundled one, resolveOpenApiSpec serves from the local file — zero network calls
  • All other versions fall through to the existing cache → GitHub fetch flow unchanged
  • Build script updated to copy bundled-spec.json into dist/ so it's available at runtime
  • Added 'bundled' to the source union type in ResolvedOpenApiSpec

Why

The CDN (b.stripecdn.com/api-artifacts/assets/openapi/...) only retains the last ~4 monthly releases (max_versions: 5 in the api-artifacts namespace config). Older versions 403. The GitHub API is also rate-limited without a token. The bundled spec gives a zero-dependency fallback for the common case of using the latest version.

Updating the bundled spec

When a new Stripe API version ships, run:

curl -sL https://raw.githubusercontent.com/stripe/openapi/master/latest/openapi.spec3.sdk.json \
  -o packages/openapi/bundled-spec.json
# bump BUNDLED_API_VERSION in packages/openapi/specFetchHelper.ts to match info.version

Test plan

  • pnpm build passes in packages/openapi
  • Requesting version 2026-03-25.dahlia returns source: 'bundled' with no network calls
  • Requesting any other version still hits cache / GitHub as before

🤖 Generated with Claude Code

…allback

Commits the latest Stripe OpenAPI SDK spec into the package so that
when a user requests the matching API version (2026-03-25.dahlia),
it is served directly from the bundled file with no network calls.

For all other versions the existing cache → GitHub fetch flow is
unchanged.

To update the bundled spec in the future:
  curl -sL https://raw.githubusercontent.com/stripe/openapi/master/latest/openapi.spec3.sdk.json \
    -o packages/openapi/bundled-spec.json
  # then bump BUNDLED_API_VERSION in specFetchHelper.ts to match info.version

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
@kdhillon-stripe kdhillon-stripe merged commit eb888cb into v2 Mar 30, 2026
6 checks passed
@kdhillon-stripe kdhillon-stripe deleted the kdhillon/bundled-openapi-spec branch March 30, 2026 20:57
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.

1 participant