plugins: [pluginVueQuery()]Vue Query
@kubb/plugin-vue-query
Generates typed TanStack Query helpers for Vue from your OpenAPI spec: queryOptions factories with their query and mutation keys. Set hooks to also get useQuery and useMutation composables, plus useInfiniteQuery when infinite is set.
- Downloads36.3K/ monthnpm, last 30 days
- GitHub stars8kubb-labs/plugins
- Unpacked size481.6kBv5.3.3 on npm
- Latest release9h agov5.3.3 · Oct 13, 2026
The Vue Query plugin generates TanStack Query helpers for Vue from your OpenAPI spec. By default you get queryOptions factories with their query keys, plus a key for each mutation. Set hooks: true to also get useQuery and useMutation composables with reactive parameters.
The plugin ships no HTTP client. Each helper calls a function generated by a client plugin.
Installation
bun add -d @kubb/plugin-vue-querypnpm add -D @kubb/plugin-vue-querynpm install --save-dev @kubb/plugin-vue-queryyarn add -D @kubb/plugin-vue-queryOr run kubb add plugin-vue-query to install the version the Kubb registry pins and add pluginVueQuery() to kubb.config.ts.
Setup
- Add
@kubb/plugin-tsand a client plugin:@kubb/plugin-fetchor@kubb/plugin-axios. Leavesdkunset on the client plugin. - Install
@tanstack/vue-query5.41 or a later v5 release andvue3.3 or a later v3 release in the app that uses the generated code. - Configure validation on the client plugin, not here.
Options worth knowing
clientpicksfetchoraxioswhen both client plugins are registered. A single client is detected automatically.hooksadds theuse*composables on top of the query option factories.infiniteaddsuseInfiniteQuerycomposables for pagination. It needshooks: trueand covers the operations that take the query parameter named ininfinite.queryParam, which defaults to'id'.queryandmutationset which HTTP methods become queries (GET) and mutations (POST,PUT,PATCH,DELETE). They also set where the TanStack Query runtime is imported from. Set either tofalseto skip those helpers.
See Options for every option and its default.
Example
The config below generates useQuery and useMutation composables that call the Fetch client.
import { defineConfig } from 'kubb/config'
import { pluginTs } from '@kubb/plugin-ts'
import { pluginFetch } from '@kubb/plugin-fetch'
import { pluginVueQuery } from '@kubb/plugin-vue-query'
export default defineConfig({
input: './petStore.yaml',
output: { path: './src/gen' },
plugins: [
pluginTs(),
pluginFetch(),
pluginVueQuery({ hooks: true }),
],
})Dependencies
Extensions that must be in the same config as Vue Query.