Skip to content

Commit

Permalink
Merge pull request #461 from kubb-project/449-support-for-refs-in-tan…
Browse files Browse the repository at this point in the history
…stack-query-for-vue

449 support for refs in tanstack query for vue
  • Loading branch information
stijnvanhulle authored Oct 9, 2023
2 parents e4471d7 + 1c77dc5 commit 09a1b34
Show file tree
Hide file tree
Showing 143 changed files with 1,206 additions and 491 deletions.
3 changes: 2 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { defineConfig } from 'vitepress'
import { createWriteStream } from 'node:fs'
import { resolve } from 'node:path'

import { SitemapStream } from 'sitemap'
import { defineConfig } from 'vitepress'

import { version } from '../../packages/core/package.json'

Expand Down
6 changes: 3 additions & 3 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// https://vitepress.dev/guide/custom-theme
import { h } from 'vue'
import DefaultTheme from 'vitepress/theme'
import { EnhanceAppContext } from 'vitepress/dist/client'
import { inject } from '@vercel/analytics'
import { EnhanceAppContext } from 'vitepress/dist/client'
import DefaultTheme from 'vitepress/theme'
import { h } from 'vue'

import HomePage from './HomePage.vue'

Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@tanstack/react-query": "^4.36.1",
"@tanstack/solid-query": "^4.36.1",
"@tanstack/svelte-query": "^4.36.1",
"@tanstack/vue-query": "^4.36.1",
"@tanstack/vue-query": "^4.36.2",
"@zodios/core": "^10.9.6",
"axios": "^1.5.1",
"msw": "^1.3.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios'

import type { AxiosError, AxiosHeaders, AxiosResponse, AxiosRequestConfig } from 'axios'
import type { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosResponse } from 'axios'

declare const AXIOS_BASE: string
declare const AXIOS_HEADERS: string
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@tanstack/react-query": "^4.36.1",
"@tanstack/solid-query": "^4.36.1",
"@tanstack/svelte-query": "^4.36.1",
"@tanstack/vue-query": "^4.36.1",
"@tanstack/vue-query": "^4.36.2",
"@zodios/core": "^10.9.6",
"axios": "^1.5.1",
"msw": "^1.3.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import client from '../../../../client'
import type { ResponseConfig } from '../../../../client'
import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../../models/ts/petController/FindPetsByStatus'

export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [`/pet/findByStatus`, ...(params ? [params] : [])] as const
export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [{ url: `/pet/findByStatus` }, ...(params ? [params] : [])] as const

export function findPetsByStatusQueryOptions<TData = FindPetsByStatusQueryResponse, TError = FindPetsByStatus400>(
params?: FindPetsByStatusQueryParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
FindPetsByTags400,
} from '../../../models/ts/petController/FindPetsByTags'

export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [`/pet/findByTags`, ...(params ? [params] : [])] as const
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: `/pet/findByTags` }, ...(params ? [params] : [])] as const

export function findPetsByTagsQueryOptions<TData = FindPetsByTagsQueryResponse, TError = FindPetsByTags400>(
headers: FindPetsByTagsHeaderParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import client from '../../../../client'
import type { ResponseConfig } from '../../../../client'
import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../../models/ts/petController/GetPetById'

export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [`/pet/${petId}`] as const
export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: `/pet/${petId}`, params: { petId: petId } }] as const

export function getPetByIdQueryOptions<TData = GetPetByIdQueryResponse, TError = GetPetById400 | GetPetById404>(
petId: GetPetByIdPathParams['petId'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import client from '../../../../client'
import type { ResponseConfig } from '../../../../client'
import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../../../models/ts/userController/GetUserByName'

export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [`/user/${username}`] as const
export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: `/user/${username}`, params: { username: username } }] as const

export function getUserByNameQueryOptions<TData = GetUserByNameQueryResponse, TError = GetUserByName400 | GetUserByName404>(
username: GetUserByNamePathParams['username'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import client from '../../../../client'
import type { ResponseConfig } from '../../../../client'
import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../../models/ts/userController/LoginUser'

export const loginUserQueryKey = (params?: LoginUserQueryParams) => [`/user/login`, ...(params ? [params] : [])] as const
export const loginUserQueryKey = (params?: LoginUserQueryParams) => [{ url: `/user/login` }, ...(params ? [params] : [])] as const

export function loginUserQueryOptions<TData = LoginUserQueryResponse, TError = LoginUser400>(
params?: LoginUserQueryParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import client from '../../../../client'
import type { ResponseConfig } from '../../../../client'
import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser'

export const logoutUserQueryKey = () => [`/user/logout`] as const
export const logoutUserQueryKey = () => [{ url: `/user/logout` }] as const

export function logoutUserQueryOptions<TData = LogoutUserQueryResponse, TError = unknown>(
options: Partial<Parameters<typeof client>[0]> = {},
Expand Down
1 change: 1 addition & 0 deletions examples/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@kubb/swagger-tanstack-query": "workspace:*",
"@kubb/swagger-ts": "workspace:*",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-devtools": "^4.36.1",
"axios": "^1.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
11 changes: 9 additions & 2 deletions examples/react-query/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { useState } from 'react'
import type { FindPetsByStatusQueryParamsStatus } from './gen'
import { useFindPetsByStatusHook } from './gen'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'

const queryClient = new QueryClient()

function Pets(): JSX.Element {
const { data: pets } = useFindPetsByStatusHook({ status: 'available' })
const [status, setStatus] = useState<FindPetsByStatusQueryParamsStatus>('available')
const { data: pets } = useFindPetsByStatusHook({ status })

return (
<>
<h1>Pets:</h1>
<h1>Pets: {status}</h1>
<ul>{pets?.map((pet) => <li key={pet.id}>{pet.name}</li>)}</ul>
<button onClick={() => setStatus('available')}>Available</button>
<button onClick={() => setStatus('pending')}>Pending</button>
</>
)
}
Expand All @@ -18,6 +24,7 @@ export function App(): JSX.Element {
return (
<QueryClientProvider client={queryClient}>
<Pets />
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query'
import client from '@kubb/swagger-client/client'
import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus'

export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [`/pet/findByStatus`, ...(params ? [params] : [])] as const
export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [{ url: `/pet/findByStatus` }, ...(params ? [params] : [])] as const

export function findPetsByStatusQueryOptions<TData = FindPetsByStatusQueryResponse, TError = FindPetsByStatus400>(
params?: FindPetsByStatusQueryParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query'
import client from '@kubb/swagger-client/client'
import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags'

export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [`/pet/findByTags`, ...(params ? [params] : [])] as const
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: `/pet/findByTags` }, ...(params ? [params] : [])] as const

export function findPetsByTagsQueryOptions<TData = FindPetsByTagsQueryResponse, TError = FindPetsByTags400>(
params?: FindPetsByTagsQueryParams,
Expand Down
2 changes: 1 addition & 1 deletion examples/react-query/src/gen/hooks/useGetInventoryHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query'
import client from '@kubb/swagger-client/client'
import type { GetInventoryQueryResponse } from '../models/GetInventory'

export const getInventoryQueryKey = () => [`/store/inventory`] as const
export const getInventoryQueryKey = () => [{ url: `/store/inventory` }] as const

export function getInventoryQueryOptions<TData = GetInventoryQueryResponse, TError = unknown>(
options: Partial<Parameters<typeof client>[0]> = {},
Expand Down
2 changes: 1 addition & 1 deletion examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query'
import client from '@kubb/swagger-client/client'
import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400 } from '../models/GetOrderById'

export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [`/store/order/${orderId}`] as const
export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [{ url: `/store/order/${orderId}`, params: { orderId: orderId } }] as const

export function getOrderByIdQueryOptions<TData = GetOrderByIdQueryResponse, TError = GetOrderById400>(
orderId: GetOrderByIdPathParams['orderId'],
Expand Down
2 changes: 1 addition & 1 deletion examples/react-query/src/gen/hooks/useGetPetByIdHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query'
import client from '@kubb/swagger-client/client'
import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400 } from '../models/GetPetById'

export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [`/pet/${petId}`] as const
export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: `/pet/${petId}`, params: { petId: petId } }] as const

export function getPetByIdQueryOptions<TData = GetPetByIdQueryResponse, TError = GetPetById400>(
petId: GetPetByIdPathParams['petId'],
Expand Down
2 changes: 1 addition & 1 deletion examples/react-query/src/gen/hooks/useGetUserByNameHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query'
import client from '@kubb/swagger-client/client'
import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400 } from '../models/GetUserByName'

export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [`/user/${username}`] as const
export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: `/user/${username}`, params: { username: username } }] as const

export function getUserByNameQueryOptions<TData = GetUserByNameQueryResponse, TError = GetUserByName400>(
username: GetUserByNamePathParams['username'],
Expand Down
2 changes: 1 addition & 1 deletion examples/react-query/src/gen/hooks/useLoginUserHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query'
import client from '@kubb/swagger-client/client'
import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser'

export const loginUserQueryKey = (params?: LoginUserQueryParams) => [`/user/login`, ...(params ? [params] : [])] as const
export const loginUserQueryKey = (params?: LoginUserQueryParams) => [{ url: `/user/login` }, ...(params ? [params] : [])] as const

export function loginUserQueryOptions<TData = LoginUserQueryResponse, TError = LoginUser400>(
params?: LoginUserQueryParams,
Expand Down
2 changes: 1 addition & 1 deletion examples/react-query/src/gen/hooks/useLogoutUserHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query'
import client from '@kubb/swagger-client/client'
import type { LogoutUserQueryResponse } from '../models/LogoutUser'

export const logoutUserQueryKey = () => [`/user/logout`] as const
export const logoutUserQueryKey = () => [{ url: `/user/logout` }] as const

export function logoutUserQueryOptions<TData = LogoutUserQueryResponse, TError = unknown>(
options: Partial<Parameters<typeof client>[0]> = {},
Expand Down
13 changes: 12 additions & 1 deletion examples/react-query/src/mocks/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { setupWorker, rest } from 'msw'

export const worker = setupWorker(
rest.get('/pets', (req, res, ctx) => {
rest.get('/pet/findByStatus', (req, res, ctx) => {
if (req.url.searchParams.get('status') === 'pending') {
return res(
ctx.json([
{
id: '1234',
name: 'Lily(pending)',
},
]),
)
}

return res(
ctx.json([
{
Expand Down
16 changes: 8 additions & 8 deletions examples/simple-single/src/gen/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function useAddPet<TData = AddPetMutationResponse, TError = AddPet405, TV
})
}

export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [`/pet/findByStatus`, ...(params ? [params] : [])] as const
export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [{ url: `/pet/findByStatus` }, ...(params ? [params] : [])] as const

export function findPetsByStatusQueryOptions<TData = FindPetsByStatusQueryResponse, TError = FindPetsByStatus400>(
params?: FindPetsByStatusQueryParams,
Expand Down Expand Up @@ -173,7 +173,7 @@ export function useFindPetsByStatus<TData = FindPetsByStatusQueryResponse, TErro
return query
}

export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [`/pet/findByTags`, ...(params ? [params] : [])] as const
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: `/pet/findByTags` }, ...(params ? [params] : [])] as const

export function findPetsByTagsQueryOptions<TData = FindPetsByTagsQueryResponse, TError = FindPetsByTags400>(
params?: FindPetsByTagsQueryParams,
Expand Down Expand Up @@ -221,7 +221,7 @@ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TError =
return query
}

export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [`/pet/${petId}`] as const
export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: `/pet/${petId}`, params: { petId: petId } }] as const

export function getPetByIdQueryOptions<TData = GetPetByIdQueryResponse, TError = GetPetById400 | GetPetById404>(
petId: GetPetByIdPathParams['petId'],
Expand Down Expand Up @@ -358,7 +358,7 @@ export function useUploadFile<TData = UploadFileMutationResponse, TError = unkno
})
}

export const getInventoryQueryKey = () => [`/store/inventory`] as const
export const getInventoryQueryKey = () => [{ url: `/store/inventory` }] as const

export function getInventoryQueryOptions<TData = GetInventoryQueryResponse, TError = unknown>(
options: Partial<Parameters<typeof client>[0]> = {},
Expand Down Expand Up @@ -459,7 +459,7 @@ export function usePlaceOrderPatch<TData = PlaceOrderPatchMutationResponse, TErr
})
}

export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [`/store/order/${orderId}`] as const
export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [{ url: `/store/order/${orderId}`, params: { orderId: orderId } }] as const

export function getOrderByIdQueryOptions<TData = GetOrderByIdQueryResponse, TError = GetOrderById400 | GetOrderById404>(
orderId: GetOrderByIdPathParams['orderId'],
Expand Down Expand Up @@ -594,7 +594,7 @@ export function useCreateUsersWithListInput<
})
}

export const loginUserQueryKey = (params?: LoginUserQueryParams) => [`/user/login`, ...(params ? [params] : [])] as const
export const loginUserQueryKey = (params?: LoginUserQueryParams) => [{ url: `/user/login` }, ...(params ? [params] : [])] as const

export function loginUserQueryOptions<TData = LoginUserQueryResponse, TError = LoginUser400>(
params?: LoginUserQueryParams,
Expand Down Expand Up @@ -641,7 +641,7 @@ export function useLoginUser<TData = LoginUserQueryResponse, TError = LoginUser4
return query
}

export const logoutUserQueryKey = () => [`/user/logout`] as const
export const logoutUserQueryKey = () => [{ url: `/user/logout` }] as const

export function logoutUserQueryOptions<TData = LogoutUserQueryResponse, TError = unknown>(
options: Partial<Parameters<typeof client>[0]> = {},
Expand Down Expand Up @@ -685,7 +685,7 @@ export function useLogoutUser<TData = LogoutUserQueryResponse, TError = unknown>
return query
}

export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [`/user/${username}`] as const
export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: `/user/${username}`, params: { username: username } }] as const

export function getUserByNameQueryOptions<TData = GetUserByNameQueryResponse, TError = GetUserByName400 | GetUserByName404>(
username: GetUserByNamePathParams['username'],
Expand Down
1 change: 0 additions & 1 deletion examples/solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"tsup": "^7.2.0"
},
"devDependencies": {
"@kubb/ts-config": "workspace:*",
"typescript": "^5.2.2"
},
"packageManager": "[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createQuery } from '@tanstack/solid-query'
import client from '@kubb/swagger-client/client'
import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus'

export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [`/pet/findByStatus`, ...(params ? [params] : [])] as const
export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [{ url: `/pet/findByStatus` }, ...(params ? [params] : [])] as const

export function findPetsByStatusQueryOptions<TData = FindPetsByStatusQueryResponse, TError = FindPetsByStatus400>(
params?: FindPetsByStatusQueryParams,
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-query/src/gen/hooks/findPetsByTagsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createQuery } from '@tanstack/solid-query'
import client from '@kubb/swagger-client/client'
import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags'

export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [`/pet/findByTags`, ...(params ? [params] : [])] as const
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: `/pet/findByTags` }, ...(params ? [params] : [])] as const

export function findPetsByTagsQueryOptions<TData = FindPetsByTagsQueryResponse, TError = FindPetsByTags400>(
params?: FindPetsByTagsQueryParams,
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-query/src/gen/hooks/getInventoryQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createQuery } from '@tanstack/solid-query'
import client from '@kubb/swagger-client/client'
import type { GetInventoryQueryResponse } from '../models/GetInventory'

export const getInventoryQueryKey = () => [`/store/inventory`] as const
export const getInventoryQueryKey = () => [{ url: `/store/inventory` }] as const

export function getInventoryQueryOptions<TData = GetInventoryQueryResponse, TError = unknown>(
options: Partial<Parameters<typeof client>[0]> = {},
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-query/src/gen/hooks/getOrderByIdQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createQuery } from '@tanstack/solid-query'
import client from '@kubb/swagger-client/client'
import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400 } from '../models/GetOrderById'

export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [`/store/order/${orderId}`] as const
export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [{ url: `/store/order/${orderId}`, params: { orderId: orderId } }] as const

export function getOrderByIdQueryOptions<TData = GetOrderByIdQueryResponse, TError = GetOrderById400>(
orderId: GetOrderByIdPathParams['orderId'],
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-query/src/gen/hooks/getPetByIdQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createQuery } from '@tanstack/solid-query'
import client from '@kubb/swagger-client/client'
import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400 } from '../models/GetPetById'

export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [`/pet/${petId}`] as const
export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: `/pet/${petId}`, params: { petId: petId } }] as const

export function getPetByIdQueryOptions<TData = GetPetByIdQueryResponse, TError = GetPetById400>(
petId: GetPetByIdPathParams['petId'],
Expand Down
2 changes: 1 addition & 1 deletion examples/solid-query/src/gen/hooks/getUserByNameQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createQuery } from '@tanstack/solid-query'
import client from '@kubb/swagger-client/client'
import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400 } from '../models/GetUserByName'

export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [`/user/${username}`] as const
export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: `/user/${username}`, params: { username: username } }] as const

export function getUserByNameQueryOptions<TData = GetUserByNameQueryResponse, TError = GetUserByName400>(
username: GetUserByNamePathParams['username'],
Expand Down
Loading

1 comment on commit 09a1b34

@vercel
Copy link

@vercel vercel bot commented on 09a1b34 Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kubb – ./

kubb-kubb.vercel.app
www.kubb.dev
kubb.dev
kubb-git-main-kubb.vercel.app

Please sign in to comment.