Beta You're reading the docs for Kubb v5, which is currently in beta. View the stable v4 docs
Skip to content

Migration: @kubb/plugin-vue-query

Part of the v4 → v5 migration guide. For the full option reference, see @kubb/plugin-vue-query.

resolver.resolveName replaces transformers.name.

Removed: paramsType, pathParamsType, paramsCasing

These three options are gone, including client.paramsCasing. Each composable now takes its parameters as a single grouped options object shaped as { path, query, body, headers }, with camelCase property names. This matches the shape @kubb/plugin-fetch already used. Query params move under query, path params under path, the request body under body, and header params under headers.

Diff
diff
  pluginVueQuery({
-   paramsType: 'object',
-   pathParamsType: 'object',
-   paramsCasing: 'camelcase',
  })

Update the call sites. Query params move into query, and path params move into path. When an operation has a required parameter in a group, that group (path, query, or headers) is required too, so an incomplete call fails to compile.

typescript
useFindPets({ status: 'available' })
useGetPet(petId)
useUpdatePet().mutate({ petId, data: pet })
typescript
useFindPets({ query: { status: 'available' } })
useGetPet({ path: { petId } })
useUpdatePet().mutate({ path: { petId }, body: pet })

The first argument is typed Omit<XxxRequestConfig, 'url'>, the RequestConfig type @kubb/plugin-ts generates. The trailing config argument is unchanged.

Generated output

The generated output changes match React Query. The *MutationKey type alias is gone, TData narrows to 2xx responses, required params are enforced in the type, and the auto enabled guard is dropped. The client call still unwraps each grouped option with toValue() so refs and getters resolve. See Generated output: @kubb/plugin-react-query.