Skip to content

refactor: consume Url path-template helper from kubb/kit#692

Merged
stijnvanhulle merged 5 commits into
mainfrom
claude/kubb-core-url-logic-b96264
Jul 14, 2026
Merged

refactor: consume Url path-template helper from kubb/kit#692
stijnvanhulle merged 5 commits into
mainfrom
claude/kubb-core-url-logic-b96264

Conversation

@stijnvanhulle

Copy link
Copy Markdown
Contributor

🎯 Changes

This repo maintained its own copy of the Url path-template helper (internals/utils/src/url.ts), with methods (toSafeTemplate, toGroupedTemplateString) that kubb core's own Url class didn't have. kubb-labs/kubb#3788 adds those methods to kubb core's Url, exposed through kubb/kit.

This PR switches every consumer over to Url from kubb/kit and deletes the local duplicate:

  • internals/client/src/components/Operation.tsx, internals/client/src/builders/sdkMethod.ts (Url.toSafeTemplate)
  • packages/plugin-cypress/src/components/Request.tsx (Url.toGroupedTemplateString)
  • packages/plugin-msw/src/components/Mock.tsx (Url.toPath)
  • internals/tanstack-query/src/components/MutationKey.tsx, internals/tanstack-query/src/components/QueryKey.tsx, internals/shared/src/operation.ts (Url.toPath)

Also removes plugin-msw's getMswUrl, which manually replaced {/} with : and then had its result passed through Url.toPath again, a redundant double conversion. Mock.tsx now calls Url.toPath(node.path) directly.

Deletes internals/utils/src/url.ts and its test, and removes the re-export from internals/utils/src/index.ts.

Bumps the kubb/@kubb/* catalog pin in pnpm-workspace.yaml to 5.0.0-beta.98, the version kubb-labs/kubb#3788's changeset will produce. This version doesn't exist yet, so pnpm install and CI will fail until kubb-labs/kubb#3788 merges and publishes. This PR should land after that one.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test (against a locally built kubb, since the published version doesn't have the new Url methods yet).

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is for the docs (no release).

Generated by Claude Code

Drop the plugins repo's own copy of the Url class now that kubb core
exposes the same toSafeTemplate/toGroupedTemplateString helpers via
kubb/kit, so path-template conversion has a single source of truth
across both repos.

Also drops plugin-msw's getMswUrl, which duplicated Url.toPath's job
and was redundantly passed through Url.toPath a second time.

Bumps the kubb/@kubb/* catalog pin to 5.0.0-beta.98, the version the
companion kubb-labs/kubb changeset produces; this won't resolve (and
CI will fail) until that version is published.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012kuZT8RUbKQT5VfC231A8e
@codesandbox

codesandbox Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 14, 2026
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 105d1b6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@kubb/plugin-cypress Patch
@kubb/plugin-msw Patch
tests-3.0.x Patch
e2e Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

claude and others added 3 commits July 14, 2026 20:50
getOperationParameters camelCased path params into valid identifiers
while leaving query/header/cookie names untouched. Drop that so every
param group keeps the exact OpenAPI name, matching kubb core's Url,
which no longer needs to rewrite names either (toSafeTemplate is gone,
and toGroupedTemplateString falls back to bracket access only for
names that aren't valid identifiers).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012kuZT8RUbKQT5VfC231A8e
…onLink

The 'pathTemplate' branch reimplemented Url.toPath's job by hand two
lines below a call to Url.toPath for the 'urlPath' case. Both branches
already produced identical output, so route them both through Url.toPath.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012kuZT8RUbKQT5VfC231A8e
@github-actions

Copy link
Copy Markdown
Contributor

📊 Dependency Size Changes

Note

🎉 This PR removes 8.4 kB of dependencies.

📦 Package 📏 Size
@kubb/ast@5.0.0-beta.97 → @kubb/ast@5.0.0-beta.98 -11.5 kB
@kubb/kit@5.0.0-beta.97 → @kubb/kit@5.0.0-beta.98 4.4 kB
@kubb/core@5.0.0-beta.97 → @kubb/core@5.0.0-beta.98 -1 kB
@kubb/adapter-oas@5.0.0-beta.97 → @kubb/adapter-oas@5.0.0-beta.98 -924 B
@kubb/mcp@5.0.0-beta.97 → @kubb/mcp@5.0.0-beta.98 696 B
@kubb/parser-ts@5.0.0-beta.97 → @kubb/parser-ts@5.0.0-beta.98 0 B
@kubb/plugin-barrel@5.0.0-beta.97 → @kubb/plugin-barrel@5.0.0-beta.98 0 B
kubb@5.0.0-beta.97 → kubb@5.0.0-beta.98 0 B
@kubb/cli@5.0.0-beta.97 → @kubb/cli@5.0.0-beta.98 0 B
@kubb/renderer-jsx@5.0.0-beta.97 → @kubb/renderer-jsx@5.0.0-beta.98 0 B
@kubb/parser-md@5.0.0-beta.97 → @kubb/parser-md@5.0.0-beta.98 0 B
unplugin-kubb@5.0.0-beta.97 → unplugin-kubb@5.0.0-beta.98 0 B

Total size change: -8.4 kB

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown
More templates

@kubb/plugin-axios

npm i https://pkg.pr.new/@kubb/plugin-axios@692

@kubb/plugin-cypress

npm i https://pkg.pr.new/@kubb/plugin-cypress@692

@kubb/plugin-faker

npm i https://pkg.pr.new/@kubb/plugin-faker@692

@kubb/plugin-fetch

npm i https://pkg.pr.new/@kubb/plugin-fetch@692

@kubb/plugin-mcp

npm i https://pkg.pr.new/@kubb/plugin-mcp@692

@kubb/plugin-msw

npm i https://pkg.pr.new/@kubb/plugin-msw@692

@kubb/plugin-react-query

npm i https://pkg.pr.new/@kubb/plugin-react-query@692

@kubb/plugin-redoc

npm i https://pkg.pr.new/@kubb/plugin-redoc@692

@kubb/plugin-swr

npm i https://pkg.pr.new/@kubb/plugin-swr@692

@kubb/plugin-ts

npm i https://pkg.pr.new/@kubb/plugin-ts@692

@kubb/plugin-vue-query

npm i https://pkg.pr.new/@kubb/plugin-vue-query@692

@kubb/plugin-zod

npm i https://pkg.pr.new/@kubb/plugin-zod@692

commit: 105d1b6

@github-actions

Copy link
Copy Markdown
Contributor

Size Change: -20.7 kB (-6.67%) ✅

Total Size: 290 kB

📦 View Changed
Filename Size Change
packages/plugin-axios/dist/index.cjs 14.1 kB -693 B (-4.68%)
packages/plugin-axios/dist/index.js 13.6 kB -684 B (-4.78%)
packages/plugin-cypress/dist/index.cjs 5.06 kB -1.46 kB (-22.33%) 🎉
packages/plugin-cypress/dist/index.js 4.99 kB -1.46 kB (-22.65%) 🎉
packages/plugin-faker/dist/index.cjs 13.6 kB -23 B (-0.17%)
packages/plugin-faker/dist/index.js 13.5 kB -21 B (-0.16%)
packages/plugin-fetch/dist/index.cjs 14.1 kB -691 B (-4.66%)
packages/plugin-fetch/dist/index.js 13.6 kB -681 B (-4.76%)
packages/plugin-mcp/dist/index.cjs 9.43 kB -1.48 kB (-13.55%) 👏
packages/plugin-mcp/dist/index.js 8.95 kB -1.47 kB (-14.09%) 👏
packages/plugin-msw/dist/index.cjs 5.33 kB -1.55 kB (-22.55%) 🎉
packages/plugin-msw/dist/index.js 5.24 kB -1.56 kB (-22.91%) 🎉
packages/plugin-react-query/dist/index.cjs 16.9 kB -1.51 kB (-8.18%)
packages/plugin-react-query/dist/index.js 16.4 kB -1.51 kB (-8.42%)
packages/plugin-swr/dist/index.cjs 11.1 kB -1.47 kB (-11.69%) 👏
packages/plugin-swr/dist/index.js 10.6 kB -1.5 kB (-12.39%) 👏
packages/plugin-ts/dist/index.cjs 23.2 kB -26 B (-0.11%)
packages/plugin-ts/dist/index.js 22.5 kB -30 B (-0.13%)
packages/plugin-vue-query/dist/index.cjs 14 kB -1.49 kB (-9.59%) 👏
packages/plugin-vue-query/dist/index.js 13.5 kB -1.48 kB (-9.9%) 👏
packages/plugin-zod/dist/index.cjs 17.1 kB +26 B (+0.15%)
packages/plugin-zod/dist/index.js 16.9 kB +30 B (+0.18%)
ℹ️ View Unchanged
Filename Size
packages/plugin-axios/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-cypress/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-faker/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-fetch/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-mcp/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-msw/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-react-query/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-redoc/dist/index.cjs 2.21 kB
packages/plugin-redoc/dist/index.js 1.75 kB
packages/plugin-redoc/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-swr/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-ts/dist/rolldown-runtime-CNktS9qV.js 291 B
packages/plugin-vue-query/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-zod/dist/rolldown-runtime-C0LytTxp.js 168 B

compressed-size-action

@stijnvanhulle stijnvanhulle merged commit 16fb95d into main Jul 14, 2026
15 checks passed
@stijnvanhulle stijnvanhulle deleted the claude/kubb-core-url-logic-b96264 branch July 14, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants