diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 373bb66cf..8b014cb54 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -182,6 +182,17 @@ const pluginsSidebar = [ }, ], }, + { + text: 'Build plugins', + collapsed: false, + items: [ + { + text: 'unplugin-kubb new', + collapsed: false, + link: '/plugins/unplugin/', + }, + ], + }, { text: 'Swagger plugins', collapsed: false, @@ -370,6 +381,17 @@ const pluginsMenu = [ }, ], }, + { + text: 'Build plugins', + collapsed: false, + items: [ + { + text: 'unplugin-kubb', + collapsed: false, + link: '/plugins/unplugin/', + }, + ], + }, { text: 'Swagger plugins', items: [ diff --git a/docs/package.json b/docs/package.json index ef88f3f9d..4f666147d 100644 --- a/docs/package.json +++ b/docs/package.json @@ -19,13 +19,13 @@ "serve": "vitepress serve" }, "dependencies": { - "@vercel/analytics": "^1.1.2", + "@vercel/analytics": "^1.2.1", "sitemap": "^7.1.1", - "vitepress": "^1.0.0-rc.41", - "vue": "^3.4.15" + "vitepress": "^1.0.0-rc.44", + "vue": "^3.4.19" }, "devDependencies": { - "@types/node": "^20.11.16" + "@types/node": "^20.11.19" }, "packageManager": "pnpm@8.3.0", "engines": { diff --git a/docs/plugins/swagger-tanstack-query/index.md b/docs/plugins/swagger-tanstack-query/index.md index c12102660..39e8c3bf3 100644 --- a/docs/plugins/swagger-tanstack-query/index.md +++ b/docs/plugins/swagger-tanstack-query/index.md @@ -638,9 +638,96 @@ export default defineConfig({ ::: +### query + +Override some useQuery behaviours. + +::: info type + +::: code-group + +```typescript [Query] +type Query = { + /** + * Customize the queryKey, here you can specify a suffix. + */ + queryKey?: (key: unknown[]) => unknown[] +} +``` + +::: + +::: info +Type: `Query`
+ +::: code-group + +```typescript [kubb.config.js] +import { defineConfig } from '@kubb/core' +import createSwagger from '@kubb/swagger' +import createSwaggerTanstackQuery from '@kubb/swagger-tanstack-query' +import createSwaggerTS from '@kubb/swagger-ts' + +export default defineConfig({ + input: { + path: './petStore.yaml', + }, + output: { + path: './src/gen', + }, + plugins: [ + createSwagger({ output: false }), + createSwaggerTS({}), + createSwaggerTanstackQuery({ query: {} }), + ], +}) +``` + +::: + +#### query.queryKey + +Customize the queryKey, here you can specify a suffix. + +::: warning +When using a string you need to use `JSON.stringify`. +::: + +::: info +Type: `(key: unknown[]) => unknown[]`
+ +::: code-group + +```typescript [kubb.config.js] +import { defineConfig } from '@kubb/core' +import createSwagger from '@kubb/swagger' +import createSwaggerTanstackQuery from '@kubb/swagger-tanstack-query' +import createSwaggerTS from '@kubb/swagger-ts' + +export default defineConfig({ + input: { + path: './petStore.yaml', + }, + output: { + path: './src/gen', + }, + plugins: [ + createSwagger({ output: false }), + createSwaggerTS({}), + createSwaggerTanstackQuery({ + query: { + queryKey: (key: string[]) => [JSON.stringify('SUFFIX'), ...key], + }, + }), + ], +}) +``` + +::: + ### suspense -When set, a suspenseQuery hooks will be added. This will only work for v5 and react. +When set, a suspenseQuery hook will be added. This will only work for v5 and react. ::: info type diff --git a/docs/plugins/unplugin/index.md b/docs/plugins/unplugin/index.md new file mode 100644 index 000000000..6c28a0074 --- /dev/null +++ b/docs/plugins/unplugin/index.md @@ -0,0 +1,186 @@ +--- +layout: doc + +title: unplugin-kubb +outline: deep +--- + +# unplugin-kubb 🦙 + +Kubb plugin for Vite, webpack, esbuild, Rollup, Nuxt, Astro and Rspack. + +## Installation + +::: code-group + +```shell [bun ] +bun add unplugin-kubb @kubb/core +``` + +```shell [pnpm ] +pnpm add unplugin-kubb @kubb/core +``` + +```shell [npm ] +npm install unplugin-kubb @kubb/core +``` + +```shell [yarn ] +yarn add unplugin-kubb @kubb/core +``` + +::: + +## Options + +### config + +Define the options for Kubb. + +::: info type + +```typescript [Options] +type Options = { + config: UserConfig +} +``` + +::: + +::: info + +Type: `Options`
+ +::: code-group + +```typescript [kubb.config.ts] +import { defineConfig } from '@kubb/core' +import createSwagger from '@kubb/swagger' +import createSwaggerTanstackQuery from '@kubb/swagger-tanstack-query' +import createSwaggerTS from '@kubb/swagger-ts' + +/** @type {import('@kubb/core').UserConfig} */ +export const config = { + root: '.', + input: { + path: './petStore.yaml', + }, + output: { + path: './src/gen', + clean: true, + }, + plugins: [ + createSwagger({ output: false }), + createSwaggerTS({ + output: { + path: 'models', + }, + }), + ], +} +``` + +```typescript [vite.config.ts] +import react from '@vitejs/plugin-react' +import kubb from 'unplugin-kubb/vite' +import { defineConfig } from 'vite' +import { config } from './kubb.config' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + react(), + kubb({ + config, + }), + ], +}) +``` + +::: + +## Examples + +### Vite + +```ts +// vite.config.ts +import Plugin from 'unplugin-kubb/vite' + +export default defineConfig({ + plugins: [ + Plugin({/* options */}), + ], +}) +``` + +### Rollup + +```ts +// rollup.config.js +import Plugin from 'unplugin-kubb/rollup' + +export default { + plugins: [ + Plugin({/* options */}), + ], +} +``` + +### webpack + +```ts +// webpack.config.js +module.exports = { + /* ... */ + plugins: [ + require('unplugin-kubb/webpack')({/* options */}), + ], +} +``` + +### Nuxt + +```ts +// nuxt.config.js +export default defineNuxtConfig({ + modules: [ + ['unplugin-kubb/nuxt', {/* options */}], + ], +}) +``` + +> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite) + +### Vue CLI + +```ts +// vue.config.js +module.exports = { + configureWebpack: { + plugins: [ + require('unplugin-kubb/webpack')({/* options */}), + ], + }, +} +``` + +### esbuild + +```ts +// esbuild.config.js +import { build } from 'esbuild' +import Plugin from 'unplugin-kubb/esbuild' + +build({ + plugins: [Plugin()], +}) +``` + +## Depended + +- [`@kubb/core`](/plugins/core/) + +## Links + +- [Vite](https://vitejs.dev/) diff --git a/e2e/package.json b/e2e/package.json index 3f0cd97e4..1bc2e3598 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -20,7 +20,7 @@ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false" }, "dependencies": { - "@faker-js/faker": "^8.4.0", + "@faker-js/faker": "^8.4.1", "@kubb/cli": "workspace:*", "@kubb/core": "workspace:*", "@kubb/swagger": "workspace:*", @@ -32,25 +32,25 @@ "@kubb/swagger-ts": "workspace:*", "@kubb/swagger-zod": "workspace:*", "@kubb/swagger-zodios": "workspace:*", - "@tanstack/react-query": "^5.18.1", - "@tanstack/solid-query": "^5.18.1", - "@tanstack/svelte-query": "^5.18.1", - "@tanstack/vue-query": "^5.18.1", + "@tanstack/react-query": "^5.21.7", + "@tanstack/solid-query": "^5.21.7", + "@tanstack/svelte-query": "^5.21.7", + "@tanstack/vue-query": "^5.21.7", "@zodios/core": "^10.9.6", "axios": "^1.6.7", "msw": "^1.3.2", "react": "^18.2.0", - "solid-js": "^1.8.12", + "solid-js": "^1.8.15", "svelte": "^3.59.2", - "swr": "^2.2.4", - "tsup": "^8.0.1", - "vue": "^3.4.15", + "swr": "^2.2.5", + "tsup": "^8.0.2", + "vue": "^3.4.19", "zod": "^3.22.4" }, "devDependencies": { "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "~5.2.2" }, "packageManager": "pnpm@8.3.0", diff --git a/examples/advanced/package.json b/examples/advanced/package.json index 579bddb27..009bedb56 100644 --- a/examples/advanced/package.json +++ b/examples/advanced/package.json @@ -24,7 +24,7 @@ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false" }, "dependencies": { - "@faker-js/faker": "^8.4.0", + "@faker-js/faker": "^8.4.1", "@kubb/cli": "workspace:*", "@kubb/core": "workspace:*", "@kubb/swagger": "workspace:*", @@ -44,15 +44,15 @@ "axios": "^1.6.7", "msw": "^1.3.2", "react": "^18.2.0", - "solid-js": "^1.8.12", + "solid-js": "^1.8.15", "svelte": "^3.59.2", - "swr": "^2.2.4", - "vue": "^3.4.15", + "swr": "^2.2.5", + "vue": "^3.4.19", "zod": "^3.22.4" }, "devDependencies": { "@kubb/ts-config": "workspace:*", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "~5.2.2" }, "packageManager": "pnpm@8.3.0", diff --git a/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts b/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts index dbf99e4a1..17b171a3b 100644 --- a/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts +++ b/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts @@ -6,15 +6,13 @@ import type { CreatePetsPathParams, CreatePetsQueryParams, CreatePetsHeaderParams, - CreatePets201, - CreatePetsError, } from '../../../models/ts/petsController/CreatePets' import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query' -type CreatePetsClient = typeof client +type CreatePetsClient = typeof client type CreatePets = { data: CreatePetsMutationResponse - error: CreatePets201 | CreatePetsError + error: never request: CreatePetsMutationRequest pathParams: CreatePetsPathParams queryParams: CreatePetsQueryParams diff --git a/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts index 1a6d0d370..d2c948f31 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts @@ -1,12 +1,12 @@ import client from '../../../../tanstack-query-client.ts' import { useMutation } from '@tanstack/react-query' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../../../models/ts/userController/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser' import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts b/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts index 360103d62..c0789c36c 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts @@ -3,18 +3,13 @@ import { useMutation } from '@tanstack/react-query' import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, } from '../../../models/ts/userController/CreateUsersWithListInput' import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/advanced/src/gen/clients/hooks/userController/useLogoutUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useLogoutUser.ts index 66a7d4b7d..f403e53f0 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useLogoutUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useLogoutUser.ts @@ -1,7 +1,7 @@ import { logoutUserQueryResponseSchema } from '../../../zod/userController/logoutUserSchema' import client from '../../../../tanstack-query-client.ts' import { useQuery, useInfiniteQuery } from '@tanstack/react-query' -import type { LogoutUserQueryResponse, LogoutUserError } from '../../../models/ts/userController/LogoutUser' +import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser' import type { UseBaseQueryOptions, UseQueryResult, @@ -12,10 +12,10 @@ import type { InfiniteData, } from '@tanstack/react-query' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never diff --git a/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts index e73bde67f..d1a7b5164 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts @@ -1,12 +1,12 @@ import client from '../../../../tanstack-query-client.ts' import { useMutation } from '@tanstack/react-query' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../../../models/ts/userController/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../../models/ts/userController/UpdateUser' import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts b/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts index 8e8205966..7e2c91ca8 100644 --- a/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts +++ b/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts @@ -7,14 +7,12 @@ import type { CreatePetsPathParams, CreatePetsQueryParams, CreatePetsHeaderParams, - CreatePets201, - CreatePetsError, } from '../../../models/ts/petsController/CreatePets' -type CreatePetsClient = typeof client +type CreatePetsClient = typeof client type CreatePets = { data: CreatePetsMutationResponse - error: CreatePets201 | CreatePetsError + error: never request: CreatePetsMutationRequest pathParams: CreatePetsPathParams queryParams: CreatePetsQueryParams diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts index de5f41281..d6b371884 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts @@ -1,12 +1,12 @@ import useSWRMutation from 'swr/mutation' import client from '../../../../swr-client.ts' import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../../../models/ts/userController/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts index d8bdfbb65..6f38b4cfa 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts @@ -4,17 +4,12 @@ import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, } from '../../../models/ts/userController/CreateUsersWithListInput' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts index 481dc448f..6b6c9b98b 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts @@ -1,12 +1,12 @@ import useSWR from 'swr' import client from '../../../../swr-client.ts' import type { SWRConfiguration, SWRResponse } from 'swr' -import type { LogoutUserQueryResponse, LogoutUserError } from '../../../models/ts/userController/LogoutUser' +import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts index b9cad2422..36fd2d038 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts @@ -1,12 +1,12 @@ import useSWRMutation from 'swr/mutation' import client from '../../../../swr-client.ts' import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../../../models/ts/userController/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../../models/ts/userController/UpdateUser' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/advanced/src/gen/mocks/createAddPetRequest.ts b/examples/advanced/src/gen/mocks/createAddPetRequest.ts index 2a9951b7d..ce206dc7b 100644 --- a/examples/advanced/src/gen/mocks/createAddPetRequest.ts +++ b/examples/advanced/src/gen/mocks/createAddPetRequest.ts @@ -3,7 +3,7 @@ import { createTagTag } from './tag/createTag' import { faker } from '@faker-js/faker' import type { AddPetRequest } from '../models/ts/AddPetRequest' -export function createAddPetRequest(override: Partial = {}): NonNullable { +export function createAddPetRequest(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/advanced/src/gen/mocks/createAddress.ts b/examples/advanced/src/gen/mocks/createAddress.ts index 81f1e6f3a..17cedcec7 100644 --- a/examples/advanced/src/gen/mocks/createAddress.ts +++ b/examples/advanced/src/gen/mocks/createAddress.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Address } from '../models/ts/Address' -export function createAddress(override: Partial
= {}): NonNullable
{ +export function createAddress(override: NonNullable> = {}): NonNullable
{ return { ...{ 'street': faker.string.alpha(), 'city': faker.string.alpha(), 'state': faker.string.alpha(), 'zip': faker.string.alpha() }, ...override, diff --git a/examples/advanced/src/gen/mocks/createApiResponse.ts b/examples/advanced/src/gen/mocks/createApiResponse.ts index 14cb4e7d4..a1c0a5e26 100644 --- a/examples/advanced/src/gen/mocks/createApiResponse.ts +++ b/examples/advanced/src/gen/mocks/createApiResponse.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { ApiResponse } from '../models/ts/ApiResponse' -export function createApiResponse(override: Partial = {}): NonNullable { +export function createApiResponse(override: NonNullable> = {}): NonNullable { return { ...{ 'code': faker.number.float({}), 'type': faker.string.alpha(), 'message': faker.string.alpha() }, ...override, diff --git a/examples/advanced/src/gen/mocks/createCategory.ts b/examples/advanced/src/gen/mocks/createCategory.ts index 8c30f40e9..17c6e8e0c 100644 --- a/examples/advanced/src/gen/mocks/createCategory.ts +++ b/examples/advanced/src/gen/mocks/createCategory.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Category } from '../models/ts/Category' -export function createCategory(override: Partial = {}): NonNullable { +export function createCategory(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'name': faker.string.alpha() }, ...override, diff --git a/examples/advanced/src/gen/mocks/createCustomer.ts b/examples/advanced/src/gen/mocks/createCustomer.ts index ecb239b1d..0ed0aa268 100644 --- a/examples/advanced/src/gen/mocks/createCustomer.ts +++ b/examples/advanced/src/gen/mocks/createCustomer.ts @@ -2,7 +2,7 @@ import { createAddress } from './createAddress' import { faker } from '@faker-js/faker' import type { Customer } from '../models/ts/Customer' -export function createCustomer(override: Partial = {}): NonNullable { +export function createCustomer(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'username': faker.string.alpha(), 'address': faker.helpers.arrayElements([createAddress()]) as any }, ...override, diff --git a/examples/advanced/src/gen/mocks/createOrder.ts b/examples/advanced/src/gen/mocks/createOrder.ts index 07e31ac4b..8db84b13b 100644 --- a/examples/advanced/src/gen/mocks/createOrder.ts +++ b/examples/advanced/src/gen/mocks/createOrder.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Order } from '../models/ts/Order' -export function createOrder(override: Partial = {}): NonNullable { +export function createOrder(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/advanced/src/gen/mocks/createPet.ts b/examples/advanced/src/gen/mocks/createPet.ts index cb09b01c8..9680017f4 100644 --- a/examples/advanced/src/gen/mocks/createPet.ts +++ b/examples/advanced/src/gen/mocks/createPet.ts @@ -3,7 +3,7 @@ import { createTagTag } from './tag/createTag' import { faker } from '@faker-js/faker' import type { Pet } from '../models/ts/Pet' -export function createPet(override: Partial = {}): NonNullable { +export function createPet(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/advanced/src/gen/mocks/createPetNotFound.ts b/examples/advanced/src/gen/mocks/createPetNotFound.ts index 96a898cea..4b6e879b0 100644 --- a/examples/advanced/src/gen/mocks/createPetNotFound.ts +++ b/examples/advanced/src/gen/mocks/createPetNotFound.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { PetNotFound } from '../models/ts/PetNotFound' -export function createPetNotFound(override: Partial = {}): NonNullable { +export function createPetNotFound(override: NonNullable> = {}): NonNullable { return { ...{ 'code': faker.number.float({}), 'message': faker.string.alpha() }, ...override, diff --git a/examples/advanced/src/gen/mocks/createUser.ts b/examples/advanced/src/gen/mocks/createUser.ts index df305a771..054ed9d81 100644 --- a/examples/advanced/src/gen/mocks/createUser.ts +++ b/examples/advanced/src/gen/mocks/createUser.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { User } from '../models/ts/User' -export function createUser(override: Partial = {}): NonNullable { +export function createUser(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/advanced/src/gen/mocks/createUserArray.ts b/examples/advanced/src/gen/mocks/createUserArray.ts index f8dff705a..c58bdd52c 100644 --- a/examples/advanced/src/gen/mocks/createUserArray.ts +++ b/examples/advanced/src/gen/mocks/createUserArray.ts @@ -2,7 +2,7 @@ import { createUser } from './createUser' import { faker } from '@faker-js/faker' import type { UserArray } from '../models/ts/UserArray' -export function createUserArray(override: Partial = []): NonNullable { +export function createUserArray(override: NonNullable> = []): NonNullable { return [ ...faker.helpers.arrayElements([createUser()]) as any, ...override, diff --git a/examples/advanced/src/gen/mocks/petController/createAddPet.ts b/examples/advanced/src/gen/mocks/petController/createAddPet.ts index 60448888a..0aff2371c 100644 --- a/examples/advanced/src/gen/mocks/petController/createAddPet.ts +++ b/examples/advanced/src/gen/mocks/petController/createAddPet.ts @@ -3,7 +3,7 @@ import { createAddPetRequest } from '../createAddPetRequest' import { createPet } from '../createPet' import type { AddPet405, AddPetMutationRequest, AddPetMutationResponse } from '../../models/ts/petController/AddPet' -export function createAddPet405(override: Partial = {}): NonNullable { +export function createAddPet405(override: NonNullable> = {}): NonNullable { return { ...{ 'code': faker.number.float({}), 'message': faker.string.alpha() }, ...override, @@ -13,13 +13,13 @@ export function createAddPet405(override: Partial = {}): NonNullable< * @description Create a new pet in the store */ -export function createAddPetMutationRequest(override?: Partial): NonNullable { +export function createAddPetMutationRequest(override?: NonNullable>): NonNullable { return createAddPetRequest(override) } /** * @description Successful operation */ -export function createAddPetMutationResponse(override?: Partial): NonNullable { +export function createAddPetMutationResponse(override?: NonNullable>): NonNullable { return createPet(override) } diff --git a/examples/advanced/src/gen/mocks/petController/createDeletePet.ts b/examples/advanced/src/gen/mocks/petController/createDeletePet.ts index da175c856..6e54680f5 100644 --- a/examples/advanced/src/gen/mocks/petController/createDeletePet.ts +++ b/examples/advanced/src/gen/mocks/petController/createDeletePet.ts @@ -5,22 +5,22 @@ import type { DeletePet400, DeletePetHeaderParams, DeletePetMutationResponse, De * @description Invalid pet value */ -export function createDeletePet400(override?: Partial): NonNullable { +export function createDeletePet400(override?: NonNullable>): NonNullable { return undefined } -export function createDeletePetHeaderParams(override: Partial = {}): NonNullable { +export function createDeletePetHeaderParams(override: NonNullable> = {}): NonNullable { return { ...{ 'api_key': faker.string.alpha() }, ...override, } } -export function createDeletePetMutationResponse(override?: Partial): NonNullable { +export function createDeletePetMutationResponse(override?: NonNullable>): NonNullable { return undefined } -export function createDeletePetPathParams(override: Partial = {}): NonNullable { +export function createDeletePetPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, diff --git a/examples/advanced/src/gen/mocks/petController/createFindPetsByStatus.ts b/examples/advanced/src/gen/mocks/petController/createFindPetsByStatus.ts index 686bc16d1..5290951d3 100644 --- a/examples/advanced/src/gen/mocks/petController/createFindPetsByStatus.ts +++ b/examples/advanced/src/gen/mocks/petController/createFindPetsByStatus.ts @@ -6,11 +6,11 @@ import type { FindPetsByStatus400, FindPetsByStatusQueryParams, FindPetsByStatus * @description Invalid status value */ -export function createFindPetsByStatus400(override?: Partial): NonNullable { +export function createFindPetsByStatus400(override?: NonNullable>): NonNullable { return undefined } -export function createFindPetsByStatusQueryParams(override: Partial = {}): NonNullable { +export function createFindPetsByStatusQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'status': faker.helpers.arrayElement([`available`, `pending`, `sold`]) }, ...override, @@ -20,7 +20,9 @@ export function createFindPetsByStatusQueryParams(override: Partial = []): NonNullable { +export function createFindPetsByStatusQueryResponse( + override: NonNullable> = [], +): NonNullable { return [ ...faker.helpers.arrayElements([createPet()]) as any, ...override, diff --git a/examples/advanced/src/gen/mocks/petController/createFindPetsByTags.ts b/examples/advanced/src/gen/mocks/petController/createFindPetsByTags.ts index 83430f353..93e1e041e 100644 --- a/examples/advanced/src/gen/mocks/petController/createFindPetsByTags.ts +++ b/examples/advanced/src/gen/mocks/petController/createFindPetsByTags.ts @@ -11,18 +11,18 @@ import type { * @description Invalid tag value */ -export function createFindPetsByTags400(override?: Partial): NonNullable { +export function createFindPetsByTags400(override?: NonNullable>): NonNullable { return undefined } -export function createFindPetsByTagsHeaderParams(override: Partial = {}): NonNullable { +export function createFindPetsByTagsHeaderParams(override: NonNullable> = {}): NonNullable { return { ...{ 'X-EXAMPLE': faker.helpers.arrayElement([`ONE`, `TWO`, `THREE`]) }, ...override, } } -export function createFindPetsByTagsQueryParams(override: Partial = {}): NonNullable { +export function createFindPetsByTagsQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'tags': faker.helpers.arrayElements([faker.string.alpha()]) as any, 'page': faker.string.alpha(), 'pageSize': faker.string.alpha() }, ...override, @@ -32,7 +32,7 @@ export function createFindPetsByTagsQueryParams(override: Partial = []): NonNullable { +export function createFindPetsByTagsQueryResponse(override: NonNullable> = []): NonNullable { return [ ...faker.helpers.arrayElements([createPet()]) as any, ...override, diff --git a/examples/advanced/src/gen/mocks/petController/createGetPetById.ts b/examples/advanced/src/gen/mocks/petController/createGetPetById.ts index 702618468..fe9f9803e 100644 --- a/examples/advanced/src/gen/mocks/petController/createGetPetById.ts +++ b/examples/advanced/src/gen/mocks/petController/createGetPetById.ts @@ -6,18 +6,18 @@ import type { GetPetById400, GetPetById404, GetPetByIdPathParams, GetPetByIdQuer * @description Invalid ID supplied */ -export function createGetPetById400(override?: Partial): NonNullable { +export function createGetPetById400(override?: NonNullable>): NonNullable { return undefined } /** * @description Pet not found */ -export function createGetPetById404(override?: Partial): NonNullable { +export function createGetPetById404(override?: NonNullable>): NonNullable { return undefined } -export function createGetPetByIdPathParams(override: Partial = {}): NonNullable { +export function createGetPetByIdPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, @@ -27,6 +27,6 @@ export function createGetPetByIdPathParams(override: Partial): NonNullable { +export function createGetPetByIdQueryResponse(override?: NonNullable>): NonNullable { return createPet(override) } diff --git a/examples/advanced/src/gen/mocks/petController/createUpdatePet.ts b/examples/advanced/src/gen/mocks/petController/createUpdatePet.ts index f119b25ab..dccb2e652 100644 --- a/examples/advanced/src/gen/mocks/petController/createUpdatePet.ts +++ b/examples/advanced/src/gen/mocks/petController/createUpdatePet.ts @@ -5,34 +5,34 @@ import type { UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutationRequest * @description Invalid ID supplied */ -export function createUpdatePet400(override?: Partial): NonNullable { +export function createUpdatePet400(override?: NonNullable>): NonNullable { return undefined } /** * @description Pet not found */ -export function createUpdatePet404(override?: Partial): NonNullable { +export function createUpdatePet404(override?: NonNullable>): NonNullable { return undefined } /** * @description Validation exception */ -export function createUpdatePet405(override?: Partial): NonNullable { +export function createUpdatePet405(override?: NonNullable>): NonNullable { return undefined } /** * @description Update an existent pet in the store */ -export function createUpdatePetMutationRequest(override?: Partial): NonNullable { +export function createUpdatePetMutationRequest(override?: NonNullable>): NonNullable { return createPet(override) } /** * @description Successful operation */ -export function createUpdatePetMutationResponse(override?: Partial): NonNullable { +export function createUpdatePetMutationResponse(override?: NonNullable>): NonNullable { return createPet(override) } diff --git a/examples/advanced/src/gen/mocks/petController/createUpdatePetWithForm.ts b/examples/advanced/src/gen/mocks/petController/createUpdatePetWithForm.ts index 7c1d672d1..01b219b71 100644 --- a/examples/advanced/src/gen/mocks/petController/createUpdatePetWithForm.ts +++ b/examples/advanced/src/gen/mocks/petController/createUpdatePetWithForm.ts @@ -10,22 +10,26 @@ import type { * @description Invalid input */ -export function createUpdatePetWithForm405(override?: Partial): NonNullable { +export function createUpdatePetWithForm405(override?: NonNullable>): NonNullable { return undefined } -export function createUpdatePetWithFormMutationResponse(override?: Partial): NonNullable { +export function createUpdatePetWithFormMutationResponse( + override?: NonNullable>, +): NonNullable { return undefined } -export function createUpdatePetWithFormPathParams(override: Partial = {}): NonNullable { +export function createUpdatePetWithFormPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, } } -export function createUpdatePetWithFormQueryParams(override: Partial = {}): NonNullable { +export function createUpdatePetWithFormQueryParams( + override: NonNullable> = {}, +): NonNullable { return { ...{ 'name': faker.string.alpha(), 'status': faker.string.alpha() }, ...override, diff --git a/examples/advanced/src/gen/mocks/petController/createUploadFile.ts b/examples/advanced/src/gen/mocks/petController/createUploadFile.ts index afd505063..4c535abf1 100644 --- a/examples/advanced/src/gen/mocks/petController/createUploadFile.ts +++ b/examples/advanced/src/gen/mocks/petController/createUploadFile.ts @@ -7,18 +7,18 @@ import type { UploadFileQueryParams, } from '../../models/ts/petController/UploadFile' -export function createUploadFileMutationRequest(override?: Partial): NonNullable { +export function createUploadFileMutationRequest(override?: NonNullable>): NonNullable { return faker.string.alpha() } -export function createUploadFilePathParams(override: Partial = {}): NonNullable { +export function createUploadFilePathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, } } -export function createUploadFileQueryParams(override: Partial = {}): NonNullable { +export function createUploadFileQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'additionalMetadata': faker.string.alpha() }, ...override, @@ -28,6 +28,6 @@ export function createUploadFileQueryParams(override: Partial): NonNullable { +export function createUploadFileMutationResponse(override?: NonNullable>): NonNullable { return createApiResponse(override) } diff --git a/examples/advanced/src/gen/mocks/petsController/createCreatePets.ts b/examples/advanced/src/gen/mocks/petsController/createCreatePets.ts index 3fb507041..dfa26d13f 100644 --- a/examples/advanced/src/gen/mocks/petsController/createCreatePets.ts +++ b/examples/advanced/src/gen/mocks/petsController/createCreatePets.ts @@ -1,8 +1,5 @@ import { faker } from '@faker-js/faker' -import { createPetNotFound } from '../createPetNotFound' import type { - CreatePets201, - CreatePetsError, CreatePetsHeaderParams, CreatePetsMutationRequest, CreatePetsMutationResponse, @@ -10,49 +7,34 @@ import type { CreatePetsQueryParams, } from '../../models/ts/petsController/CreatePets' -/** - * @description Null response - */ - -export function createCreatePets201(override?: Partial): NonNullable { - return undefined -} - -export function createCreatePetsHeaderParams(override: Partial = {}): NonNullable { +export function createCreatePetsHeaderParams(override: NonNullable> = {}): NonNullable { return { ...{ 'X-EXAMPLE': faker.helpers.arrayElement([`ONE`, `TWO`, `THREE`]) }, ...override, } } -export function createCreatePetsMutationRequest(override: Partial = {}): NonNullable { +export function createCreatePetsMutationRequest(override: NonNullable> = {}): NonNullable { return { ...{ 'name': faker.string.alpha(), 'tag': faker.string.alpha() }, ...override, } } -export function createCreatePetsMutationResponse(override?: Partial): NonNullable { +export function createCreatePetsMutationResponse(override?: NonNullable>): NonNullable { return undefined } -export function createCreatePetsPathParams(override: Partial = {}): NonNullable { +export function createCreatePetsPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'uuid': faker.string.alpha() }, ...override, } } -export function createCreatePetsQueryParams(override: Partial = {}): NonNullable { +export function createCreatePetsQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'offset': faker.number.float({}) }, ...override, } } -/** - * @description unexpected error - */ - -export function createCreatePetsError(override?: Partial): NonNullable { - return createPetNotFound(override) -} diff --git a/examples/advanced/src/gen/mocks/tag/createTag.ts b/examples/advanced/src/gen/mocks/tag/createTag.ts index e34a60778..44061486d 100644 --- a/examples/advanced/src/gen/mocks/tag/createTag.ts +++ b/examples/advanced/src/gen/mocks/tag/createTag.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { TagTag } from '../../models/ts/tag/Tag' -export function createTagTag(override: Partial = {}): NonNullable { +export function createTagTag(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'name': faker.string.alpha() }, ...override, diff --git a/examples/advanced/src/gen/mocks/userController/createCreateUser.ts b/examples/advanced/src/gen/mocks/userController/createCreateUser.ts index 800d8b6d8..0b5a71938 100644 --- a/examples/advanced/src/gen/mocks/userController/createCreateUser.ts +++ b/examples/advanced/src/gen/mocks/userController/createCreateUser.ts @@ -1,20 +1,13 @@ import { createUser } from '../createUser' -import type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/ts/userController/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/ts/userController/CreateUser' -export function createCreateUserMutationResponse(override?: Partial): NonNullable { +export function createCreateUserMutationResponse(override?: NonNullable>): NonNullable { return undefined } -/** - * @description successful operation - */ - -export function createCreateUserError(override?: Partial): NonNullable { - return createUser(override) -} /** * @description Created user object */ -export function createCreateUserMutationRequest(override?: Partial): NonNullable { +export function createCreateUserMutationRequest(override?: NonNullable>): NonNullable { return createUser(override) } diff --git a/examples/advanced/src/gen/mocks/userController/createCreateUsersWithListInput.ts b/examples/advanced/src/gen/mocks/userController/createCreateUsersWithListInput.ts index 6be93cf0a..7cd077e9e 100644 --- a/examples/advanced/src/gen/mocks/userController/createCreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/mocks/userController/createCreateUsersWithListInput.ts @@ -1,21 +1,9 @@ import { faker } from '@faker-js/faker' import { createUser } from '../createUser' -import type { - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, -} from '../../models/ts/userController/CreateUsersWithListInput' - -/** - * @description successful operation - */ - -export function createCreateUsersWithListInputError(override?: Partial): NonNullable { - return undefined -} +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../../models/ts/userController/CreateUsersWithListInput' export function createCreateUsersWithListInputMutationRequest( - override: Partial = [], + override: NonNullable> = [], ): NonNullable { return [ ...faker.helpers.arrayElements([createUser()]) as any, @@ -27,7 +15,7 @@ export function createCreateUsersWithListInputMutationRequest( */ export function createCreateUsersWithListInputMutationResponse( - override?: Partial, + override?: NonNullable>, ): NonNullable { return createUser(override) } diff --git a/examples/advanced/src/gen/mocks/userController/createDeleteUser.ts b/examples/advanced/src/gen/mocks/userController/createDeleteUser.ts index 726c54ad2..c24e1d0dc 100644 --- a/examples/advanced/src/gen/mocks/userController/createDeleteUser.ts +++ b/examples/advanced/src/gen/mocks/userController/createDeleteUser.ts @@ -5,22 +5,22 @@ import type { DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUs * @description Invalid username supplied */ -export function createDeleteUser400(override?: Partial): NonNullable { +export function createDeleteUser400(override?: NonNullable>): NonNullable { return undefined } /** * @description User not found */ -export function createDeleteUser404(override?: Partial): NonNullable { +export function createDeleteUser404(override?: NonNullable>): NonNullable { return undefined } -export function createDeleteUserMutationResponse(override?: Partial): NonNullable { +export function createDeleteUserMutationResponse(override?: NonNullable>): NonNullable { return undefined } -export function createDeleteUserPathParams(override: Partial = {}): NonNullable { +export function createDeleteUserPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'username': faker.string.alpha() }, ...override, diff --git a/examples/advanced/src/gen/mocks/userController/createGetUserByName.ts b/examples/advanced/src/gen/mocks/userController/createGetUserByName.ts index 087b062f4..a8da37d97 100644 --- a/examples/advanced/src/gen/mocks/userController/createGetUserByName.ts +++ b/examples/advanced/src/gen/mocks/userController/createGetUserByName.ts @@ -6,18 +6,18 @@ import type { GetUserByName400, GetUserByName404, GetUserByNamePathParams, GetUs * @description Invalid username supplied */ -export function createGetUserByName400(override?: Partial): NonNullable { +export function createGetUserByName400(override?: NonNullable>): NonNullable { return undefined } /** * @description User not found */ -export function createGetUserByName404(override?: Partial): NonNullable { +export function createGetUserByName404(override?: NonNullable>): NonNullable { return undefined } -export function createGetUserByNamePathParams(override: Partial = {}): NonNullable { +export function createGetUserByNamePathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'username': faker.string.alpha() }, ...override, @@ -27,6 +27,6 @@ export function createGetUserByNamePathParams(override: Partial): NonNullable { +export function createGetUserByNameQueryResponse(override?: NonNullable>): NonNullable { return createUser(override) } diff --git a/examples/advanced/src/gen/mocks/userController/createLoginUser.ts b/examples/advanced/src/gen/mocks/userController/createLoginUser.ts index b3edf6dc6..f6ff5fd44 100644 --- a/examples/advanced/src/gen/mocks/userController/createLoginUser.ts +++ b/examples/advanced/src/gen/mocks/userController/createLoginUser.ts @@ -5,11 +5,11 @@ import type { LoginUser400, LoginUserQueryParams, LoginUserQueryResponse } from * @description Invalid username/password supplied */ -export function createLoginUser400(override?: Partial): NonNullable { +export function createLoginUser400(override?: NonNullable>): NonNullable { return undefined } -export function createLoginUserQueryParams(override: Partial = {}): NonNullable { +export function createLoginUserQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'username': faker.string.alpha(), 'password': faker.internet.password() }, ...override, @@ -19,6 +19,6 @@ export function createLoginUserQueryParams(override: Partial): NonNullable { +export function createLoginUserQueryResponse(override?: NonNullable>): NonNullable { return faker.string.alpha() } diff --git a/examples/advanced/src/gen/mocks/userController/createLogoutUser.ts b/examples/advanced/src/gen/mocks/userController/createLogoutUser.ts index 4c35ce1d7..24b203ef9 100644 --- a/examples/advanced/src/gen/mocks/userController/createLogoutUser.ts +++ b/examples/advanced/src/gen/mocks/userController/createLogoutUser.ts @@ -1,13 +1,5 @@ -import type { LogoutUserError, LogoutUserQueryResponse } from '../../models/ts/userController/LogoutUser' +import type { LogoutUserQueryResponse } from '../../models/ts/userController/LogoutUser' -/** - * @description successful operation - */ - -export function createLogoutUserError(override?: Partial): NonNullable { - return undefined -} - -export function createLogoutUserQueryResponse(override?: Partial): NonNullable { +export function createLogoutUserQueryResponse(override?: NonNullable>): NonNullable { return undefined } diff --git a/examples/advanced/src/gen/mocks/userController/createUpdateUser.ts b/examples/advanced/src/gen/mocks/userController/createUpdateUser.ts index e99c48242..b71e1d7f9 100644 --- a/examples/advanced/src/gen/mocks/userController/createUpdateUser.ts +++ b/examples/advanced/src/gen/mocks/userController/createUpdateUser.ts @@ -1,20 +1,12 @@ import { faker } from '@faker-js/faker' import { createUser } from '../createUser' -import type { UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/ts/userController/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/ts/userController/UpdateUser' -/** - * @description successful operation - */ - -export function createUpdateUserError(override?: Partial): NonNullable { - return undefined -} - -export function createUpdateUserMutationResponse(override?: Partial): NonNullable { +export function createUpdateUserMutationResponse(override?: NonNullable>): NonNullable { return undefined } -export function createUpdateUserPathParams(override: Partial = {}): NonNullable { +export function createUpdateUserPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'username': faker.string.alpha() }, ...override, @@ -24,6 +16,6 @@ export function createUpdateUserPathParams(override: Partial): NonNullable { +export function createUpdateUserMutationRequest(override?: NonNullable>): NonNullable { return createUser(override) } diff --git a/examples/advanced/src/gen/models/ts/petsController/CreatePets.ts b/examples/advanced/src/gen/models/ts/petsController/CreatePets.ts index 24aaa16f4..db1c1d840 100644 --- a/examples/advanced/src/gen/models/ts/petsController/CreatePets.ts +++ b/examples/advanced/src/gen/models/ts/petsController/CreatePets.ts @@ -1,10 +1,3 @@ -import type { PetNotFound } from '../PetNotFound' - -/** - * @description Null response - */ -export type CreatePets201 = any | null - export const CreatePetsHeaderParamsXExample = { 'ONE': 'ONE', 'TWO': 'TWO', @@ -47,16 +40,10 @@ export type CreatePetsQueryParams = { */ offset?: number } | undefined - -/** - * @description unexpected error - */ -export type CreatePetsError = PetNotFound export type CreatePetsMutation = { Response: CreatePetsMutationResponse Request: CreatePetsMutationRequest PathParams: CreatePetsPathParams QueryParams: CreatePetsQueryParams HeaderParams: CreatePetsHeaderParams - Errors: CreatePets201 | CreatePetsError } diff --git a/examples/advanced/src/gen/models/ts/userController/CreateUser.ts b/examples/advanced/src/gen/models/ts/userController/CreateUser.ts index 1631ef078..3c81e30d2 100644 --- a/examples/advanced/src/gen/models/ts/userController/CreateUser.ts +++ b/examples/advanced/src/gen/models/ts/userController/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from '../User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/advanced/src/gen/models/ts/userController/CreateUsersWithListInput.ts b/examples/advanced/src/gen/models/ts/userController/CreateUsersWithListInput.ts index 44cc12101..fc417db1b 100644 --- a/examples/advanced/src/gen/models/ts/userController/CreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/models/ts/userController/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from '../User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/advanced/src/gen/models/ts/userController/LogoutUser.ts b/examples/advanced/src/gen/models/ts/userController/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/advanced/src/gen/models/ts/userController/LogoutUser.ts +++ b/examples/advanced/src/gen/models/ts/userController/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/advanced/src/gen/models/ts/userController/UpdateUser.ts b/examples/advanced/src/gen/models/ts/userController/UpdateUser.ts index 244b5b512..62e732657 100644 --- a/examples/advanced/src/gen/models/ts/userController/UpdateUser.ts +++ b/examples/advanced/src/gen/models/ts/userController/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from '../User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/advanced/src/gen/zod/petsController/createPetsSchema.ts b/examples/advanced/src/gen/zod/petsController/createPetsSchema.ts index 2ae242ba1..71037c057 100644 --- a/examples/advanced/src/gen/zod/petsController/createPetsSchema.ts +++ b/examples/advanced/src/gen/zod/petsController/createPetsSchema.ts @@ -1,17 +1,7 @@ import { z } from 'zod' -import { petNotFoundSchema } from '../petNotFoundSchema' -/** - * @description Null response - */ -export const createPets201Schema = z.any() export const createPetsHeaderParamsSchema = z.object({ 'X-EXAMPLE': z.enum([`ONE`, `TWO`, `THREE`]).describe(`Header parameters`) }) export const createPetsMutationRequestSchema = z.object({ 'name': z.string(), 'tag': z.string() }) export const createPetsMutationResponseSchema = z.any() export const createPetsPathParamsSchema = z.object({ 'uuid': z.string().describe(`UUID`) }) export const createPetsQueryParamsSchema = z.object({ 'offset': z.number().describe(`Offset`).optional() }).optional() - -/** - * @description unexpected error - */ -export const createPetsErrorSchema = z.lazy(() => petNotFoundSchema) diff --git a/examples/advanced/src/gen/zod/userController/createUserSchema.ts b/examples/advanced/src/gen/zod/userController/createUserSchema.ts index 485524cde..47fd8c900 100644 --- a/examples/advanced/src/gen/zod/userController/createUserSchema.ts +++ b/examples/advanced/src/gen/zod/userController/createUserSchema.ts @@ -3,11 +3,6 @@ import { userSchema } from '../userSchema' export const createUserMutationResponseSchema = z.any() -/** - * @description successful operation - */ -export const createUserErrorSchema = z.lazy(() => userSchema) - /** * @description Created user object */ diff --git a/examples/advanced/src/gen/zod/userController/createUsersWithListInputSchema.ts b/examples/advanced/src/gen/zod/userController/createUsersWithListInputSchema.ts index 7fa2465a3..918f83203 100644 --- a/examples/advanced/src/gen/zod/userController/createUsersWithListInputSchema.ts +++ b/examples/advanced/src/gen/zod/userController/createUsersWithListInputSchema.ts @@ -1,10 +1,6 @@ import { z } from 'zod' import { userSchema } from '../userSchema' -/** - * @description successful operation - */ -export const createUsersWithListInputErrorSchema = z.any() export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema)) /** diff --git a/examples/advanced/src/gen/zod/userController/logoutUserSchema.ts b/examples/advanced/src/gen/zod/userController/logoutUserSchema.ts index 43123061a..92cf0018a 100644 --- a/examples/advanced/src/gen/zod/userController/logoutUserSchema.ts +++ b/examples/advanced/src/gen/zod/userController/logoutUserSchema.ts @@ -1,7 +1,3 @@ import { z } from 'zod' -/** - * @description successful operation - */ -export const logoutUserErrorSchema = z.any() export const logoutUserQueryResponseSchema = z.any() diff --git a/examples/advanced/src/gen/zod/userController/updateUserSchema.ts b/examples/advanced/src/gen/zod/userController/updateUserSchema.ts index 3f99ccf26..453367fc0 100644 --- a/examples/advanced/src/gen/zod/userController/updateUserSchema.ts +++ b/examples/advanced/src/gen/zod/userController/updateUserSchema.ts @@ -1,10 +1,6 @@ import { z } from 'zod' import { userSchema } from '../userSchema' -/** - * @description successful operation - */ -export const updateUserErrorSchema = z.any() export const updateUserMutationResponseSchema = z.any() export const updateUserPathParamsSchema = z.object({ 'username': z.string().describe(`name that need to be deleted`) }) diff --git a/examples/advanced/src/gen/zodios.ts b/examples/advanced/src/gen/zodios.ts index 8f80a4bb8..52c720bff 100644 --- a/examples/advanced/src/gen/zodios.ts +++ b/examples/advanced/src/gen/zodios.ts @@ -5,7 +5,6 @@ import { createPetsQueryParamsSchema, createPetsHeaderParamsSchema, createPetsMutationRequestSchema, - createPets201Schema, } from './zod/petsController/createPetsSchema' import { addPetMutationResponseSchema, addPetMutationRequestSchema, addPet405Schema } from './zod/petController/addPetSchema' import { @@ -90,13 +89,7 @@ export const endpoints = makeApi([ }, ], response: createPetsMutationResponseSchema, - errors: [ - { - status: 201, - description: `Null response`, - schema: createPets201Schema, - }, - ], + errors: [], }, { method: 'post', diff --git a/examples/client/package.json b/examples/client/package.json index 3d9d074a4..7b139f9f8 100644 --- a/examples/client/package.json +++ b/examples/client/package.json @@ -31,7 +31,7 @@ "devDependencies": { "@kubb/ts-config": "workspace:*", "react": "^18.2.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "packageManager": "pnpm@8.3.0", diff --git a/examples/client/src/gen/models/ts/petsController/CreatePets.ts b/examples/client/src/gen/models/ts/petsController/CreatePets.ts index 24aaa16f4..db1c1d840 100644 --- a/examples/client/src/gen/models/ts/petsController/CreatePets.ts +++ b/examples/client/src/gen/models/ts/petsController/CreatePets.ts @@ -1,10 +1,3 @@ -import type { PetNotFound } from '../PetNotFound' - -/** - * @description Null response - */ -export type CreatePets201 = any | null - export const CreatePetsHeaderParamsXExample = { 'ONE': 'ONE', 'TWO': 'TWO', @@ -47,16 +40,10 @@ export type CreatePetsQueryParams = { */ offset?: number } | undefined - -/** - * @description unexpected error - */ -export type CreatePetsError = PetNotFound export type CreatePetsMutation = { Response: CreatePetsMutationResponse Request: CreatePetsMutationRequest PathParams: CreatePetsPathParams QueryParams: CreatePetsQueryParams HeaderParams: CreatePetsHeaderParams - Errors: CreatePets201 | CreatePetsError } diff --git a/examples/client/src/gen/models/ts/userController/CreateUser.ts b/examples/client/src/gen/models/ts/userController/CreateUser.ts index 1631ef078..3c81e30d2 100644 --- a/examples/client/src/gen/models/ts/userController/CreateUser.ts +++ b/examples/client/src/gen/models/ts/userController/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from '../User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/client/src/gen/models/ts/userController/CreateUsersWithListInput.ts b/examples/client/src/gen/models/ts/userController/CreateUsersWithListInput.ts index 44cc12101..fc417db1b 100644 --- a/examples/client/src/gen/models/ts/userController/CreateUsersWithListInput.ts +++ b/examples/client/src/gen/models/ts/userController/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from '../User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/client/src/gen/models/ts/userController/LogoutUser.ts b/examples/client/src/gen/models/ts/userController/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/client/src/gen/models/ts/userController/LogoutUser.ts +++ b/examples/client/src/gen/models/ts/userController/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/client/src/gen/models/ts/userController/UpdateUser.ts b/examples/client/src/gen/models/ts/userController/UpdateUser.ts index 244b5b512..62e732657 100644 --- a/examples/client/src/gen/models/ts/userController/UpdateUser.ts +++ b/examples/client/src/gen/models/ts/userController/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from '../User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/faker/package.json b/examples/faker/package.json index 453435703..3bc782d46 100644 --- a/examples/faker/package.json +++ b/examples/faker/package.json @@ -23,7 +23,7 @@ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false" }, "dependencies": { - "@faker-js/faker": "^8.4.0", + "@faker-js/faker": "^8.4.1", "@kubb/cli": "workspace:*", "@kubb/core": "workspace:*", "@kubb/swagger": "workspace:*", @@ -31,7 +31,7 @@ "@kubb/swagger-faker": "workspace:*", "@kubb/swagger-ts": "workspace:*", "react": "^18.2.0", - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "devDependencies": { "@kubb/ts-config": "workspace:*", diff --git a/examples/faker/src/gen/customMocks/createAddress.ts b/examples/faker/src/gen/customMocks/createAddress.ts index 66e076705..b91580a4d 100644 --- a/examples/faker/src/gen/customMocks/createAddress.ts +++ b/examples/faker/src/gen/customMocks/createAddress.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Address } from '../models/Address' -export function createAddress(override: Partial
= {}): NonNullable
{ +export function createAddress(override: NonNullable> = {}): NonNullable
{ return { ...{ 'street': faker.string.alpha(), diff --git a/examples/faker/src/gen/customMocks/createApiResponse.ts b/examples/faker/src/gen/customMocks/createApiResponse.ts index 54010bc50..4a7ba8b24 100644 --- a/examples/faker/src/gen/customMocks/createApiResponse.ts +++ b/examples/faker/src/gen/customMocks/createApiResponse.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { ApiResponse } from '../models/ApiResponse' -export function createApiResponse(override: Partial = {}): NonNullable { +export function createApiResponse(override: NonNullable> = {}): NonNullable { return { ...{ 'code': faker.number.float({}), 'type': faker.string.alpha(), 'message': faker.string.alpha() }, ...override, diff --git a/examples/faker/src/gen/customMocks/createCategory.ts b/examples/faker/src/gen/customMocks/createCategory.ts index bee33be4f..604f47a92 100644 --- a/examples/faker/src/gen/customMocks/createCategory.ts +++ b/examples/faker/src/gen/customMocks/createCategory.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Category } from '../models/Category' -export function createCategory(override: Partial = {}): NonNullable { +export function createCategory(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'name': faker.commerce.productName() }, ...override, diff --git a/examples/faker/src/gen/customMocks/createCustomer.ts b/examples/faker/src/gen/customMocks/createCustomer.ts index 9a14d9ea3..b49bc82c6 100644 --- a/examples/faker/src/gen/customMocks/createCustomer.ts +++ b/examples/faker/src/gen/customMocks/createCustomer.ts @@ -2,7 +2,7 @@ import { createAddress } from './createAddress' import { faker } from '@faker-js/faker' import type { Customer } from '../models/Customer' -export function createCustomer(override: Partial = {}): NonNullable { +export function createCustomer(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'username': faker.string.alpha(), 'address': faker.helpers.arrayElements([createAddress()]) as any }, ...override, diff --git a/examples/faker/src/gen/customMocks/createOrder.ts b/examples/faker/src/gen/customMocks/createOrder.ts index 48b9329f6..13fda47f0 100644 --- a/examples/faker/src/gen/customMocks/createOrder.ts +++ b/examples/faker/src/gen/customMocks/createOrder.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Order } from '../models/Order' -export function createOrder(override: Partial = {}): NonNullable { +export function createOrder(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/faker/src/gen/customMocks/createPet.ts b/examples/faker/src/gen/customMocks/createPet.ts index d135fc2c5..0428029a4 100644 --- a/examples/faker/src/gen/customMocks/createPet.ts +++ b/examples/faker/src/gen/customMocks/createPet.ts @@ -3,7 +3,7 @@ import { createTag } from './createTag' import { faker } from '@faker-js/faker' import type { Pet } from '../models/Pet' -export function createPet(override: Partial = {}): NonNullable { +export function createPet(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/faker/src/gen/customMocks/createTag.ts b/examples/faker/src/gen/customMocks/createTag.ts index fe4d6b911..94bf388ec 100644 --- a/examples/faker/src/gen/customMocks/createTag.ts +++ b/examples/faker/src/gen/customMocks/createTag.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Tag } from '../models/Tag' -export function createTag(override: Partial = {}): NonNullable { +export function createTag(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'name': faker.commerce.productName() }, ...override, diff --git a/examples/faker/src/gen/customMocks/createUpdatePet.ts b/examples/faker/src/gen/customMocks/createUpdatePet.ts index bad2e7355..ba8331a2b 100644 --- a/examples/faker/src/gen/customMocks/createUpdatePet.ts +++ b/examples/faker/src/gen/customMocks/createUpdatePet.ts @@ -5,34 +5,34 @@ import type { UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutationRequest * @description Invalid ID supplied */ -export function createUpdatePet400(override?: Partial): NonNullable { +export function createUpdatePet400(override?: NonNullable>): NonNullable { return undefined } /** * @description Pet not found */ -export function createUpdatePet404(override?: Partial): NonNullable { +export function createUpdatePet404(override?: NonNullable>): NonNullable { return undefined } /** * @description Validation exception */ -export function createUpdatePet405(override?: Partial): NonNullable { +export function createUpdatePet405(override?: NonNullable>): NonNullable { return undefined } /** * @description Update an existent pet in the store */ -export function createUpdatePetMutationRequest(override?: Partial): NonNullable { +export function createUpdatePetMutationRequest(override?: NonNullable>): NonNullable { return createPet(override) } /** * @description Successful operation */ -export function createUpdatePetMutationResponse(override?: Partial): NonNullable { +export function createUpdatePetMutationResponse(override?: NonNullable>): NonNullable { return createPet(override) } diff --git a/examples/faker/src/gen/customMocks/createUpdatePetWithForm.ts b/examples/faker/src/gen/customMocks/createUpdatePetWithForm.ts index 36c3b6ca6..cf02fb6d8 100644 --- a/examples/faker/src/gen/customMocks/createUpdatePetWithForm.ts +++ b/examples/faker/src/gen/customMocks/createUpdatePetWithForm.ts @@ -10,22 +10,26 @@ import type { * @description Invalid input */ -export function createUpdatePetWithForm405(override?: Partial): NonNullable { +export function createUpdatePetWithForm405(override?: NonNullable>): NonNullable { return undefined } -export function createUpdatePetWithFormMutationResponse(override?: Partial): NonNullable { +export function createUpdatePetWithFormMutationResponse( + override?: NonNullable>, +): NonNullable { return undefined } -export function createUpdatePetWithFormPathParams(override: Partial = {}): NonNullable { +export function createUpdatePetWithFormPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, } } -export function createUpdatePetWithFormQueryParams(override: Partial = {}): NonNullable { +export function createUpdatePetWithFormQueryParams( + override: NonNullable> = {}, +): NonNullable { return { ...{ 'name': faker.commerce.productName(), 'status': faker.string.alpha() }, ...override, diff --git a/examples/faker/src/gen/customMocks/createUser.ts b/examples/faker/src/gen/customMocks/createUser.ts index 835cdc137..202f67349 100644 --- a/examples/faker/src/gen/customMocks/createUser.ts +++ b/examples/faker/src/gen/customMocks/createUser.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { User } from '../models/User' -export function createUser(override: Partial = {}): NonNullable { +export function createUser(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/faker/src/gen/customMocks/createUserArray.ts b/examples/faker/src/gen/customMocks/createUserArray.ts index c2176ef8a..6d881aea6 100644 --- a/examples/faker/src/gen/customMocks/createUserArray.ts +++ b/examples/faker/src/gen/customMocks/createUserArray.ts @@ -2,7 +2,7 @@ import { createUser } from './createUser' import { faker } from '@faker-js/faker' import type { UserArray } from '../models/UserArray' -export function createUserArray(override: Partial = []): NonNullable { +export function createUserArray(override: NonNullable> = []): NonNullable { return [ ...faker.helpers.arrayElements([createUser()]) as any, ...override, diff --git a/examples/faker/src/gen/models/CreateUser.ts b/examples/faker/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/faker/src/gen/models/CreateUser.ts +++ b/examples/faker/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/faker/src/gen/models/CreateUsersWithListInput.ts b/examples/faker/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/faker/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/faker/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/faker/src/gen/models/LogoutUser.ts b/examples/faker/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/faker/src/gen/models/LogoutUser.ts +++ b/examples/faker/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/faker/src/gen/models/UpdateUser.ts b/examples/faker/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/faker/src/gen/models/UpdateUser.ts +++ b/examples/faker/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/msw-v2/package.json b/examples/msw-v2/package.json index dd0c0e804..2f0a01b7b 100644 --- a/examples/msw-v2/package.json +++ b/examples/msw-v2/package.json @@ -24,7 +24,7 @@ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false" }, "dependencies": { - "@faker-js/faker": "^8.4.0", + "@faker-js/faker": "^8.4.1", "@kubb/cli": "workspace:*", "@kubb/core": "workspace:*", "@kubb/swagger": "workspace:*", @@ -33,9 +33,9 @@ "@kubb/swagger-msw": "workspace:*", "@kubb/swagger-ts": "workspace:*", "@mswjs/http-middleware": "^0.9.2", - "msw": "^2.1.5", + "msw": "^2.2.1", "react": "^18.2.0", - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "devDependencies": { "@kubb/ts-config": "workspace:*", diff --git a/examples/msw-v2/src/gen/mocks/createAddPetRequest.ts b/examples/msw-v2/src/gen/mocks/createAddPetRequest.ts index 4eaf00cc2..89164597f 100644 --- a/examples/msw-v2/src/gen/mocks/createAddPetRequest.ts +++ b/examples/msw-v2/src/gen/mocks/createAddPetRequest.ts @@ -3,7 +3,7 @@ import { createTag } from './createTag' import { faker } from '@faker-js/faker' import type { AddPetRequest } from '../models/AddPetRequest' -export function createAddPetRequest(override: Partial = {}): NonNullable { +export function createAddPetRequest(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ diff --git a/examples/msw-v2/src/gen/mocks/createAddress.ts b/examples/msw-v2/src/gen/mocks/createAddress.ts index 08d9a0212..d2f74327e 100644 --- a/examples/msw-v2/src/gen/mocks/createAddress.ts +++ b/examples/msw-v2/src/gen/mocks/createAddress.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Address } from '../models/Address' -export function createAddress(override: Partial
= {}): NonNullable
{ +export function createAddress(override: NonNullable> = {}): NonNullable
{ faker.seed([220]) return { ...{ 'street': faker.string.alpha(), 'city': faker.string.alpha(), 'state': faker.string.alpha(), 'zip': faker.string.alpha() }, diff --git a/examples/msw-v2/src/gen/mocks/createApiResponse.ts b/examples/msw-v2/src/gen/mocks/createApiResponse.ts index 661ed3f5e..cfcecf4ab 100644 --- a/examples/msw-v2/src/gen/mocks/createApiResponse.ts +++ b/examples/msw-v2/src/gen/mocks/createApiResponse.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { ApiResponse } from '../models/ApiResponse' -export function createApiResponse(override: Partial = {}): NonNullable { +export function createApiResponse(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'code': faker.number.float({}), 'type': faker.string.alpha(), 'message': faker.string.alpha() }, diff --git a/examples/msw-v2/src/gen/mocks/createCategory.ts b/examples/msw-v2/src/gen/mocks/createCategory.ts index d70b14687..1f767ea2c 100644 --- a/examples/msw-v2/src/gen/mocks/createCategory.ts +++ b/examples/msw-v2/src/gen/mocks/createCategory.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Category } from '../models/Category' -export function createCategory(override: Partial = {}): NonNullable { +export function createCategory(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'id': faker.number.float({}), 'name': faker.string.alpha() }, diff --git a/examples/msw-v2/src/gen/mocks/createCustomer.ts b/examples/msw-v2/src/gen/mocks/createCustomer.ts index 99f501441..56c9c06eb 100644 --- a/examples/msw-v2/src/gen/mocks/createCustomer.ts +++ b/examples/msw-v2/src/gen/mocks/createCustomer.ts @@ -2,7 +2,7 @@ import { createAddress } from './createAddress' import { faker } from '@faker-js/faker' import type { Customer } from '../models/Customer' -export function createCustomer(override: Partial = {}): NonNullable { +export function createCustomer(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'id': faker.number.float({}), 'username': faker.string.alpha(), 'address': faker.helpers.arrayElements([createAddress()]) as any }, diff --git a/examples/msw-v2/src/gen/mocks/createOrder.ts b/examples/msw-v2/src/gen/mocks/createOrder.ts index a1fe85ab7..e3bbe3841 100644 --- a/examples/msw-v2/src/gen/mocks/createOrder.ts +++ b/examples/msw-v2/src/gen/mocks/createOrder.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Order } from '../models/Order' -export function createOrder(override: Partial = {}): NonNullable { +export function createOrder(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ diff --git a/examples/msw-v2/src/gen/mocks/createPet.ts b/examples/msw-v2/src/gen/mocks/createPet.ts index 4523bba38..6a243f49c 100644 --- a/examples/msw-v2/src/gen/mocks/createPet.ts +++ b/examples/msw-v2/src/gen/mocks/createPet.ts @@ -3,7 +3,7 @@ import { createTag } from './createTag' import { faker } from '@faker-js/faker' import type { Pet } from '../models/Pet' -export function createPet(override: Partial = {}): NonNullable { +export function createPet(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ diff --git a/examples/msw-v2/src/gen/mocks/createPetNotFound.ts b/examples/msw-v2/src/gen/mocks/createPetNotFound.ts index d7517bff4..127d81067 100644 --- a/examples/msw-v2/src/gen/mocks/createPetNotFound.ts +++ b/examples/msw-v2/src/gen/mocks/createPetNotFound.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { PetNotFound } from '../models/PetNotFound' -export function createPetNotFound(override: Partial = {}): NonNullable { +export function createPetNotFound(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'code': faker.number.float({}), 'message': faker.string.alpha() }, diff --git a/examples/msw-v2/src/gen/mocks/createTag.ts b/examples/msw-v2/src/gen/mocks/createTag.ts index e87ffb625..b7ad4820f 100644 --- a/examples/msw-v2/src/gen/mocks/createTag.ts +++ b/examples/msw-v2/src/gen/mocks/createTag.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Tag } from '../models/Tag' -export function createTag(override: Partial = {}): NonNullable { +export function createTag(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'id': faker.number.float({}), 'name': faker.string.alpha() }, diff --git a/examples/msw-v2/src/gen/mocks/createUser.ts b/examples/msw-v2/src/gen/mocks/createUser.ts index b4cc8ea45..3af2c52a7 100644 --- a/examples/msw-v2/src/gen/mocks/createUser.ts +++ b/examples/msw-v2/src/gen/mocks/createUser.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { User } from '../models/User' -export function createUser(override: Partial = {}): NonNullable { +export function createUser(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ diff --git a/examples/msw-v2/src/gen/mocks/createUserArray.ts b/examples/msw-v2/src/gen/mocks/createUserArray.ts index 4bdabc507..f357aacdb 100644 --- a/examples/msw-v2/src/gen/mocks/createUserArray.ts +++ b/examples/msw-v2/src/gen/mocks/createUserArray.ts @@ -2,7 +2,7 @@ import { createUser } from './createUser' import { faker } from '@faker-js/faker' import type { UserArray } from '../models/UserArray' -export function createUserArray(override: Partial = []): NonNullable { +export function createUserArray(override: NonNullable> = []): NonNullable { faker.seed([220]) return [ ...faker.helpers.arrayElements([createUser()]) as any, diff --git a/examples/msw-v2/src/gen/mocks/petMocks/createAddPet.ts b/examples/msw-v2/src/gen/mocks/petMocks/createAddPet.ts index b0470ad9e..2f6ed5fc8 100644 --- a/examples/msw-v2/src/gen/mocks/petMocks/createAddPet.ts +++ b/examples/msw-v2/src/gen/mocks/petMocks/createAddPet.ts @@ -3,7 +3,7 @@ import { createAddPetRequest } from '../createAddPetRequest' import { createPet } from '../createPet' import type { AddPet405, AddPetMutationRequest, AddPetMutationResponse } from '../../models/AddPet' -export function createAddPet405(override: Partial = {}): NonNullable { +export function createAddPet405(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'code': faker.number.float({}), 'message': faker.string.alpha() }, @@ -14,7 +14,7 @@ export function createAddPet405(override: Partial = {}): NonNullable< * @description Create a new pet in the store */ -export function createAddPetMutationRequest(override?: Partial): NonNullable { +export function createAddPetMutationRequest(override?: NonNullable>): NonNullable { faker.seed([220]) return createAddPetRequest(override) } @@ -22,7 +22,7 @@ export function createAddPetMutationRequest(override?: Partial): NonNullable { +export function createAddPetMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return createPet(override) } diff --git a/examples/msw-v2/src/gen/mocks/petMocks/createDeletePet.ts b/examples/msw-v2/src/gen/mocks/petMocks/createDeletePet.ts index 02f9be1b5..84e83fcde 100644 --- a/examples/msw-v2/src/gen/mocks/petMocks/createDeletePet.ts +++ b/examples/msw-v2/src/gen/mocks/petMocks/createDeletePet.ts @@ -5,12 +5,12 @@ import type { DeletePet400, DeletePetHeaderParams, DeletePetMutationResponse, De * @description Invalid pet value */ -export function createDeletePet400(override?: Partial): NonNullable { +export function createDeletePet400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createDeletePetHeaderParams(override: Partial = {}): NonNullable { +export function createDeletePetHeaderParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'api_key': faker.string.alpha() }, @@ -18,12 +18,12 @@ export function createDeletePetHeaderParams(override: Partial): NonNullable { +export function createDeletePetMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createDeletePetPathParams(override: Partial = {}): NonNullable { +export function createDeletePetPathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'petId': faker.number.float({}) }, diff --git a/examples/msw-v2/src/gen/mocks/petMocks/createFindPetsByStatus.ts b/examples/msw-v2/src/gen/mocks/petMocks/createFindPetsByStatus.ts index b10f552bc..523d1bb02 100644 --- a/examples/msw-v2/src/gen/mocks/petMocks/createFindPetsByStatus.ts +++ b/examples/msw-v2/src/gen/mocks/petMocks/createFindPetsByStatus.ts @@ -6,12 +6,12 @@ import type { FindPetsByStatus400, FindPetsByStatusQueryParams, FindPetsByStatus * @description Invalid status value */ -export function createFindPetsByStatus400(override?: Partial): NonNullable { +export function createFindPetsByStatus400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createFindPetsByStatusQueryParams(override: Partial = {}): NonNullable { +export function createFindPetsByStatusQueryParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'status': faker.helpers.arrayElement([`available`, `pending`, `sold`]) }, @@ -22,7 +22,9 @@ export function createFindPetsByStatusQueryParams(override: Partial = []): NonNullable { +export function createFindPetsByStatusQueryResponse( + override: NonNullable> = [], +): NonNullable { faker.seed([220]) return [ ...faker.helpers.arrayElements([createPet()]) as any, diff --git a/examples/msw-v2/src/gen/mocks/petMocks/createFindPetsByTags.ts b/examples/msw-v2/src/gen/mocks/petMocks/createFindPetsByTags.ts index 2fca83d07..52ee91c41 100644 --- a/examples/msw-v2/src/gen/mocks/petMocks/createFindPetsByTags.ts +++ b/examples/msw-v2/src/gen/mocks/petMocks/createFindPetsByTags.ts @@ -6,12 +6,12 @@ import type { FindPetsByTags400, FindPetsByTagsQueryParams, FindPetsByTagsQueryR * @description Invalid tag value */ -export function createFindPetsByTags400(override?: Partial): NonNullable { +export function createFindPetsByTags400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createFindPetsByTagsQueryParams(override: Partial = {}): NonNullable { +export function createFindPetsByTagsQueryParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'tags': faker.helpers.arrayElements([faker.string.alpha()]) as any, 'page': faker.string.alpha(), 'pageSize': faker.string.alpha() }, @@ -22,7 +22,7 @@ export function createFindPetsByTagsQueryParams(override: Partial = []): NonNullable { +export function createFindPetsByTagsQueryResponse(override: NonNullable> = []): NonNullable { faker.seed([220]) return [ ...faker.helpers.arrayElements([createPet()]) as any, diff --git a/examples/msw-v2/src/gen/mocks/petMocks/createGetPetById.ts b/examples/msw-v2/src/gen/mocks/petMocks/createGetPetById.ts index d258f92b8..79ebee916 100644 --- a/examples/msw-v2/src/gen/mocks/petMocks/createGetPetById.ts +++ b/examples/msw-v2/src/gen/mocks/petMocks/createGetPetById.ts @@ -6,7 +6,7 @@ import type { GetPetById400, GetPetById404, GetPetByIdPathParams, GetPetByIdQuer * @description Invalid ID supplied */ -export function createGetPetById400(override?: Partial): NonNullable { +export function createGetPetById400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } @@ -14,12 +14,12 @@ export function createGetPetById400(override?: Partial): NonNulla * @description Pet not found */ -export function createGetPetById404(override?: Partial): NonNullable { +export function createGetPetById404(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createGetPetByIdPathParams(override: Partial = {}): NonNullable { +export function createGetPetByIdPathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'petId': faker.number.float({}) }, @@ -30,7 +30,7 @@ export function createGetPetByIdPathParams(override: Partial): NonNullable { +export function createGetPetByIdQueryResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return createPet(override) } diff --git a/examples/msw-v2/src/gen/mocks/petMocks/createUpdatePet.ts b/examples/msw-v2/src/gen/mocks/petMocks/createUpdatePet.ts index 353f703fe..f888f367d 100644 --- a/examples/msw-v2/src/gen/mocks/petMocks/createUpdatePet.ts +++ b/examples/msw-v2/src/gen/mocks/petMocks/createUpdatePet.ts @@ -6,7 +6,7 @@ import type { UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutationRequest * @description Invalid ID supplied */ -export function createUpdatePet400(override?: Partial): NonNullable { +export function createUpdatePet400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } @@ -14,7 +14,7 @@ export function createUpdatePet400(override?: Partial): NonNullabl * @description Pet not found */ -export function createUpdatePet404(override?: Partial): NonNullable { +export function createUpdatePet404(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } @@ -22,7 +22,7 @@ export function createUpdatePet404(override?: Partial): NonNullabl * @description Validation exception */ -export function createUpdatePet405(override?: Partial): NonNullable { +export function createUpdatePet405(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } @@ -30,7 +30,7 @@ export function createUpdatePet405(override?: Partial): NonNullabl * @description Update an existent pet in the store */ -export function createUpdatePetMutationRequest(override?: Partial): NonNullable { +export function createUpdatePetMutationRequest(override?: NonNullable>): NonNullable { faker.seed([220]) return createPet(override) } @@ -38,7 +38,7 @@ export function createUpdatePetMutationRequest(override?: Partial): NonNullable { +export function createUpdatePetMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return createPet(override) } diff --git a/examples/msw-v2/src/gen/mocks/petMocks/createUpdatePetWithForm.ts b/examples/msw-v2/src/gen/mocks/petMocks/createUpdatePetWithForm.ts index 467bfaf86..7b3fa7cfc 100644 --- a/examples/msw-v2/src/gen/mocks/petMocks/createUpdatePetWithForm.ts +++ b/examples/msw-v2/src/gen/mocks/petMocks/createUpdatePetWithForm.ts @@ -10,17 +10,19 @@ import type { * @description Invalid input */ -export function createUpdatePetWithForm405(override?: Partial): NonNullable { +export function createUpdatePetWithForm405(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createUpdatePetWithFormMutationResponse(override?: Partial): NonNullable { +export function createUpdatePetWithFormMutationResponse( + override?: NonNullable>, +): NonNullable { faker.seed([220]) return undefined } -export function createUpdatePetWithFormPathParams(override: Partial = {}): NonNullable { +export function createUpdatePetWithFormPathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'petId': faker.number.float({}) }, @@ -28,7 +30,9 @@ export function createUpdatePetWithFormPathParams(override: Partial = {}): NonNullable { +export function createUpdatePetWithFormQueryParams( + override: NonNullable> = {}, +): NonNullable { faker.seed([220]) return { ...{ 'name': faker.string.alpha(), 'status': faker.string.alpha() }, diff --git a/examples/msw-v2/src/gen/mocks/petMocks/createUploadFile.ts b/examples/msw-v2/src/gen/mocks/petMocks/createUploadFile.ts index ac17e4e93..c7c896094 100644 --- a/examples/msw-v2/src/gen/mocks/petMocks/createUploadFile.ts +++ b/examples/msw-v2/src/gen/mocks/petMocks/createUploadFile.ts @@ -2,12 +2,12 @@ import { faker } from '@faker-js/faker' import { createApiResponse } from '../createApiResponse' import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../../models/UploadFile' -export function createUploadFileMutationRequest(override?: Partial): NonNullable { +export function createUploadFileMutationRequest(override?: NonNullable>): NonNullable { faker.seed([220]) return faker.string.alpha() } -export function createUploadFilePathParams(override: Partial = {}): NonNullable { +export function createUploadFilePathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'petId': faker.number.float({}) }, @@ -15,7 +15,7 @@ export function createUploadFilePathParams(override: Partial = {}): NonNullable { +export function createUploadFileQueryParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'additionalMetadata': faker.string.alpha() }, @@ -26,7 +26,7 @@ export function createUploadFileQueryParams(override: Partial): NonNullable { +export function createUploadFileMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return createApiResponse(override) } diff --git a/examples/msw-v2/src/gen/mocks/storeMocks/createDeleteOrder.ts b/examples/msw-v2/src/gen/mocks/storeMocks/createDeleteOrder.ts index 5a1284513..242d86964 100644 --- a/examples/msw-v2/src/gen/mocks/storeMocks/createDeleteOrder.ts +++ b/examples/msw-v2/src/gen/mocks/storeMocks/createDeleteOrder.ts @@ -5,7 +5,7 @@ import type { DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, Delet * @description Invalid ID supplied */ -export function createDeleteOrder400(override?: Partial): NonNullable { +export function createDeleteOrder400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } @@ -13,17 +13,17 @@ export function createDeleteOrder400(override?: Partial): NonNul * @description Order not found */ -export function createDeleteOrder404(override?: Partial): NonNullable { +export function createDeleteOrder404(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createDeleteOrderMutationResponse(override?: Partial): NonNullable { +export function createDeleteOrderMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createDeleteOrderPathParams(override: Partial = {}): NonNullable { +export function createDeleteOrderPathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'orderId': faker.number.float({}) }, diff --git a/examples/msw-v2/src/gen/mocks/storeMocks/createGetInventory.ts b/examples/msw-v2/src/gen/mocks/storeMocks/createGetInventory.ts index 121df4fa0..dbbe03070 100644 --- a/examples/msw-v2/src/gen/mocks/storeMocks/createGetInventory.ts +++ b/examples/msw-v2/src/gen/mocks/storeMocks/createGetInventory.ts @@ -5,7 +5,7 @@ import type { GetInventoryQueryResponse } from '../../models/GetInventory' * @description successful operation */ -export function createGetInventoryQueryResponse(override: Partial = {}): NonNullable { +export function createGetInventoryQueryResponse(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{}, diff --git a/examples/msw-v2/src/gen/mocks/storeMocks/createGetOrderById.ts b/examples/msw-v2/src/gen/mocks/storeMocks/createGetOrderById.ts index 59908805e..679b6ec8f 100644 --- a/examples/msw-v2/src/gen/mocks/storeMocks/createGetOrderById.ts +++ b/examples/msw-v2/src/gen/mocks/storeMocks/createGetOrderById.ts @@ -6,7 +6,7 @@ import type { GetOrderById400, GetOrderById404, GetOrderByIdPathParams, GetOrder * @description Invalid ID supplied */ -export function createGetOrderById400(override?: Partial): NonNullable { +export function createGetOrderById400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } @@ -14,12 +14,12 @@ export function createGetOrderById400(override?: Partial): NonN * @description Order not found */ -export function createGetOrderById404(override?: Partial): NonNullable { +export function createGetOrderById404(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createGetOrderByIdPathParams(override: Partial = {}): NonNullable { +export function createGetOrderByIdPathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'orderId': faker.number.float({}) }, @@ -30,7 +30,7 @@ export function createGetOrderByIdPathParams(override: Partial): NonNullable { +export function createGetOrderByIdQueryResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return createOrder(override) } diff --git a/examples/msw-v2/src/gen/mocks/storeMocks/createPlaceOrder.ts b/examples/msw-v2/src/gen/mocks/storeMocks/createPlaceOrder.ts index d29328336..2cf96eb83 100644 --- a/examples/msw-v2/src/gen/mocks/storeMocks/createPlaceOrder.ts +++ b/examples/msw-v2/src/gen/mocks/storeMocks/createPlaceOrder.ts @@ -6,12 +6,12 @@ import type { PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationRespon * @description Invalid input */ -export function createPlaceOrder405(override?: Partial): NonNullable { +export function createPlaceOrder405(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createPlaceOrderMutationRequest(override?: Partial): NonNullable { +export function createPlaceOrderMutationRequest(override?: NonNullable>): NonNullable { faker.seed([220]) return createOrder(override) } @@ -19,7 +19,7 @@ export function createPlaceOrderMutationRequest(override?: Partial): NonNullable { +export function createPlaceOrderMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return createOrder(override) } diff --git a/examples/msw-v2/src/gen/mocks/storeMocks/createPlaceOrderPatch.ts b/examples/msw-v2/src/gen/mocks/storeMocks/createPlaceOrderPatch.ts index 0b6e401ef..6cfd2023f 100644 --- a/examples/msw-v2/src/gen/mocks/storeMocks/createPlaceOrderPatch.ts +++ b/examples/msw-v2/src/gen/mocks/storeMocks/createPlaceOrderPatch.ts @@ -6,12 +6,14 @@ import type { PlaceOrderPatch405, PlaceOrderPatchMutationRequest, PlaceOrderPatc * @description Invalid input */ -export function createPlaceOrderPatch405(override?: Partial): NonNullable { +export function createPlaceOrderPatch405(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createPlaceOrderPatchMutationRequest(override?: Partial): NonNullable { +export function createPlaceOrderPatchMutationRequest( + override?: NonNullable>, +): NonNullable { faker.seed([220]) return createOrder(override) } @@ -19,7 +21,9 @@ export function createPlaceOrderPatchMutationRequest(override?: Partial): NonNullable { +export function createPlaceOrderPatchMutationResponse( + override?: NonNullable>, +): NonNullable { faker.seed([220]) return createOrder(override) } diff --git a/examples/msw-v2/src/gen/mocks/userMocks/createCreateUser.ts b/examples/msw-v2/src/gen/mocks/userMocks/createCreateUser.ts index 5947390b2..f25f86b4f 100644 --- a/examples/msw-v2/src/gen/mocks/userMocks/createCreateUser.ts +++ b/examples/msw-v2/src/gen/mocks/userMocks/createCreateUser.ts @@ -1,24 +1,16 @@ import { faker } from '@faker-js/faker' import { createUser } from '../createUser' -import type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/CreateUser' -export function createCreateUserMutationResponse(override?: Partial): NonNullable { +export function createCreateUserMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -/** - * @description successful operation - */ - -export function createCreateUserError(override?: Partial): NonNullable { - faker.seed([220]) - return createUser(override) -} /** * @description Created user object */ -export function createCreateUserMutationRequest(override?: Partial): NonNullable { +export function createCreateUserMutationRequest(override?: NonNullable>): NonNullable { faker.seed([220]) return createUser(override) } diff --git a/examples/msw-v2/src/gen/mocks/userMocks/createCreateUsersWithListInput.ts b/examples/msw-v2/src/gen/mocks/userMocks/createCreateUsersWithListInput.ts index 4e2a87e64..6df517a3d 100644 --- a/examples/msw-v2/src/gen/mocks/userMocks/createCreateUsersWithListInput.ts +++ b/examples/msw-v2/src/gen/mocks/userMocks/createCreateUsersWithListInput.ts @@ -1,22 +1,9 @@ import { faker } from '@faker-js/faker' import { createUser } from '../createUser' -import type { - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, -} from '../../models/CreateUsersWithListInput' - -/** - * @description successful operation - */ - -export function createCreateUsersWithListInputError(override?: Partial): NonNullable { - faker.seed([220]) - return undefined -} +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../../models/CreateUsersWithListInput' export function createCreateUsersWithListInputMutationRequest( - override: Partial = [], + override: NonNullable> = [], ): NonNullable { faker.seed([220]) return [ @@ -29,7 +16,7 @@ export function createCreateUsersWithListInputMutationRequest( */ export function createCreateUsersWithListInputMutationResponse( - override?: Partial, + override?: NonNullable>, ): NonNullable { faker.seed([220]) return createUser(override) diff --git a/examples/msw-v2/src/gen/mocks/userMocks/createDeleteUser.ts b/examples/msw-v2/src/gen/mocks/userMocks/createDeleteUser.ts index 6faf37db3..5697a9df2 100644 --- a/examples/msw-v2/src/gen/mocks/userMocks/createDeleteUser.ts +++ b/examples/msw-v2/src/gen/mocks/userMocks/createDeleteUser.ts @@ -5,7 +5,7 @@ import type { DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUs * @description Invalid username supplied */ -export function createDeleteUser400(override?: Partial): NonNullable { +export function createDeleteUser400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } @@ -13,17 +13,17 @@ export function createDeleteUser400(override?: Partial): NonNulla * @description User not found */ -export function createDeleteUser404(override?: Partial): NonNullable { +export function createDeleteUser404(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createDeleteUserMutationResponse(override?: Partial): NonNullable { +export function createDeleteUserMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createDeleteUserPathParams(override: Partial = {}): NonNullable { +export function createDeleteUserPathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'username': faker.string.alpha() }, diff --git a/examples/msw-v2/src/gen/mocks/userMocks/createGetUserByName.ts b/examples/msw-v2/src/gen/mocks/userMocks/createGetUserByName.ts index d1d256001..1a3f33466 100644 --- a/examples/msw-v2/src/gen/mocks/userMocks/createGetUserByName.ts +++ b/examples/msw-v2/src/gen/mocks/userMocks/createGetUserByName.ts @@ -6,7 +6,7 @@ import type { GetUserByName400, GetUserByName404, GetUserByNamePathParams, GetUs * @description Invalid username supplied */ -export function createGetUserByName400(override?: Partial): NonNullable { +export function createGetUserByName400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } @@ -14,12 +14,12 @@ export function createGetUserByName400(override?: Partial): No * @description User not found */ -export function createGetUserByName404(override?: Partial): NonNullable { +export function createGetUserByName404(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createGetUserByNamePathParams(override: Partial = {}): NonNullable { +export function createGetUserByNamePathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'username': faker.string.alpha() }, @@ -30,7 +30,7 @@ export function createGetUserByNamePathParams(override: Partial): NonNullable { +export function createGetUserByNameQueryResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return createUser(override) } diff --git a/examples/msw-v2/src/gen/mocks/userMocks/createLoginUser.ts b/examples/msw-v2/src/gen/mocks/userMocks/createLoginUser.ts index 989dd87c2..64ad45e9d 100644 --- a/examples/msw-v2/src/gen/mocks/userMocks/createLoginUser.ts +++ b/examples/msw-v2/src/gen/mocks/userMocks/createLoginUser.ts @@ -5,12 +5,12 @@ import type { LoginUser400, LoginUserQueryParams, LoginUserQueryResponse } from * @description Invalid username/password supplied */ -export function createLoginUser400(override?: Partial): NonNullable { +export function createLoginUser400(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createLoginUserQueryParams(override: Partial = {}): NonNullable { +export function createLoginUserQueryParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'username': faker.string.alpha(), 'password': faker.internet.password() }, @@ -21,7 +21,7 @@ export function createLoginUserQueryParams(override: Partial): NonNullable { +export function createLoginUserQueryResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return faker.string.alpha() } diff --git a/examples/msw-v2/src/gen/mocks/userMocks/createLogoutUser.ts b/examples/msw-v2/src/gen/mocks/userMocks/createLogoutUser.ts index 1eed311fc..1dddab5d2 100644 --- a/examples/msw-v2/src/gen/mocks/userMocks/createLogoutUser.ts +++ b/examples/msw-v2/src/gen/mocks/userMocks/createLogoutUser.ts @@ -1,16 +1,7 @@ import { faker } from '@faker-js/faker' -import type { LogoutUserError, LogoutUserQueryResponse } from '../../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../../models/LogoutUser' -/** - * @description successful operation - */ - -export function createLogoutUserError(override?: Partial): NonNullable { - faker.seed([220]) - return undefined -} - -export function createLogoutUserQueryResponse(override?: Partial): NonNullable { +export function createLogoutUserQueryResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } diff --git a/examples/msw-v2/src/gen/mocks/userMocks/createUpdateUser.ts b/examples/msw-v2/src/gen/mocks/userMocks/createUpdateUser.ts index db4b1e7ac..be0ed0ff6 100644 --- a/examples/msw-v2/src/gen/mocks/userMocks/createUpdateUser.ts +++ b/examples/msw-v2/src/gen/mocks/userMocks/createUpdateUser.ts @@ -1,22 +1,13 @@ import { faker } from '@faker-js/faker' import { createUser } from '../createUser' -import type { UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/UpdateUser' -/** - * @description successful operation - */ - -export function createUpdateUserError(override?: Partial): NonNullable { - faker.seed([220]) - return undefined -} - -export function createUpdateUserMutationResponse(override?: Partial): NonNullable { +export function createUpdateUserMutationResponse(override?: NonNullable>): NonNullable { faker.seed([220]) return undefined } -export function createUpdateUserPathParams(override: Partial = {}): NonNullable { +export function createUpdateUserPathParams(override: NonNullable> = {}): NonNullable { faker.seed([220]) return { ...{ 'username': faker.string.alpha() }, @@ -27,7 +18,7 @@ export function createUpdateUserPathParams(override: Partial): NonNullable { +export function createUpdateUserMutationRequest(override?: NonNullable>): NonNullable { faker.seed([220]) return createUser(override) } diff --git a/examples/msw-v2/src/gen/models/CreateUser.ts b/examples/msw-v2/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/msw-v2/src/gen/models/CreateUser.ts +++ b/examples/msw-v2/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/msw-v2/src/gen/models/CreateUsersWithListInput.ts b/examples/msw-v2/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/msw-v2/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/msw-v2/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/msw-v2/src/gen/models/LogoutUser.ts b/examples/msw-v2/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/msw-v2/src/gen/models/LogoutUser.ts +++ b/examples/msw-v2/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/msw-v2/src/gen/models/UpdateUser.ts b/examples/msw-v2/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/msw-v2/src/gen/models/UpdateUser.ts +++ b/examples/msw-v2/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/msw/package.json b/examples/msw/package.json index f1498484f..72f9ce665 100644 --- a/examples/msw/package.json +++ b/examples/msw/package.json @@ -24,7 +24,7 @@ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false" }, "dependencies": { - "@faker-js/faker": "^8.4.0", + "@faker-js/faker": "^8.4.1", "@kubb/cli": "workspace:*", "@kubb/core": "workspace:*", "@kubb/swagger": "workspace:*", @@ -35,7 +35,7 @@ "@mswjs/http-middleware": "0.8.0", "msw": "^1.3.2", "react": "^18.2.0", - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "devDependencies": { "@kubb/ts-config": "workspace:*", diff --git a/examples/msw/src/gen/mocks/createAddPetRequest.ts b/examples/msw/src/gen/mocks/createAddPetRequest.ts index 649c31219..7402ef634 100644 --- a/examples/msw/src/gen/mocks/createAddPetRequest.ts +++ b/examples/msw/src/gen/mocks/createAddPetRequest.ts @@ -3,7 +3,7 @@ import { createTag } from './createTag' import { faker } from '@faker-js/faker' import type { AddPetRequest } from '../models/AddPetRequest' -export function createAddPetRequest(override: Partial = {}): NonNullable { +export function createAddPetRequest(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/msw/src/gen/mocks/createAddress.ts b/examples/msw/src/gen/mocks/createAddress.ts index b458f0eb0..b124d73a0 100644 --- a/examples/msw/src/gen/mocks/createAddress.ts +++ b/examples/msw/src/gen/mocks/createAddress.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Address } from '../models/Address' -export function createAddress(override: Partial
= {}): NonNullable
{ +export function createAddress(override: NonNullable> = {}): NonNullable
{ return { ...{ 'street': faker.string.alpha(), 'city': faker.string.alpha(), 'state': faker.string.alpha(), 'zip': faker.string.alpha() }, ...override, diff --git a/examples/msw/src/gen/mocks/createApiResponse.ts b/examples/msw/src/gen/mocks/createApiResponse.ts index 54010bc50..4a7ba8b24 100644 --- a/examples/msw/src/gen/mocks/createApiResponse.ts +++ b/examples/msw/src/gen/mocks/createApiResponse.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { ApiResponse } from '../models/ApiResponse' -export function createApiResponse(override: Partial = {}): NonNullable { +export function createApiResponse(override: NonNullable> = {}): NonNullable { return { ...{ 'code': faker.number.float({}), 'type': faker.string.alpha(), 'message': faker.string.alpha() }, ...override, diff --git a/examples/msw/src/gen/mocks/createCategory.ts b/examples/msw/src/gen/mocks/createCategory.ts index b000844e9..442176eb9 100644 --- a/examples/msw/src/gen/mocks/createCategory.ts +++ b/examples/msw/src/gen/mocks/createCategory.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Category } from '../models/Category' -export function createCategory(override: Partial = {}): NonNullable { +export function createCategory(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'name': faker.string.alpha() }, ...override, diff --git a/examples/msw/src/gen/mocks/createCustomer.ts b/examples/msw/src/gen/mocks/createCustomer.ts index 9a14d9ea3..b49bc82c6 100644 --- a/examples/msw/src/gen/mocks/createCustomer.ts +++ b/examples/msw/src/gen/mocks/createCustomer.ts @@ -2,7 +2,7 @@ import { createAddress } from './createAddress' import { faker } from '@faker-js/faker' import type { Customer } from '../models/Customer' -export function createCustomer(override: Partial = {}): NonNullable { +export function createCustomer(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'username': faker.string.alpha(), 'address': faker.helpers.arrayElements([createAddress()]) as any }, ...override, diff --git a/examples/msw/src/gen/mocks/createOrder.ts b/examples/msw/src/gen/mocks/createOrder.ts index b704c0c7c..b2792a8c6 100644 --- a/examples/msw/src/gen/mocks/createOrder.ts +++ b/examples/msw/src/gen/mocks/createOrder.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Order } from '../models/Order' -export function createOrder(override: Partial = {}): NonNullable { +export function createOrder(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/msw/src/gen/mocks/createPet.ts b/examples/msw/src/gen/mocks/createPet.ts index 1e25536e7..dcd55486d 100644 --- a/examples/msw/src/gen/mocks/createPet.ts +++ b/examples/msw/src/gen/mocks/createPet.ts @@ -3,7 +3,7 @@ import { createTag } from './createTag' import { faker } from '@faker-js/faker' import type { Pet } from '../models/Pet' -export function createPet(override: Partial = {}): NonNullable { +export function createPet(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/msw/src/gen/mocks/createPetNotFound.ts b/examples/msw/src/gen/mocks/createPetNotFound.ts index 53cd20e44..7bb538986 100644 --- a/examples/msw/src/gen/mocks/createPetNotFound.ts +++ b/examples/msw/src/gen/mocks/createPetNotFound.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { PetNotFound } from '../models/PetNotFound' -export function createPetNotFound(override: Partial = {}): NonNullable { +export function createPetNotFound(override: NonNullable> = {}): NonNullable { return { ...{ 'code': faker.number.float({}), 'message': faker.string.alpha() }, ...override, diff --git a/examples/msw/src/gen/mocks/createTag.ts b/examples/msw/src/gen/mocks/createTag.ts index 61d3238e5..de84f25cf 100644 --- a/examples/msw/src/gen/mocks/createTag.ts +++ b/examples/msw/src/gen/mocks/createTag.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { Tag } from '../models/Tag' -export function createTag(override: Partial = {}): NonNullable { +export function createTag(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), 'name': faker.string.alpha() }, ...override, diff --git a/examples/msw/src/gen/mocks/createUser.ts b/examples/msw/src/gen/mocks/createUser.ts index 835cdc137..202f67349 100644 --- a/examples/msw/src/gen/mocks/createUser.ts +++ b/examples/msw/src/gen/mocks/createUser.ts @@ -1,7 +1,7 @@ import { faker } from '@faker-js/faker' import type { User } from '../models/User' -export function createUser(override: Partial = {}): NonNullable { +export function createUser(override: NonNullable> = {}): NonNullable { return { ...{ 'id': faker.number.float({}), diff --git a/examples/msw/src/gen/mocks/createUserArray.ts b/examples/msw/src/gen/mocks/createUserArray.ts index c2176ef8a..6d881aea6 100644 --- a/examples/msw/src/gen/mocks/createUserArray.ts +++ b/examples/msw/src/gen/mocks/createUserArray.ts @@ -2,7 +2,7 @@ import { createUser } from './createUser' import { faker } from '@faker-js/faker' import type { UserArray } from '../models/UserArray' -export function createUserArray(override: Partial = []): NonNullable { +export function createUserArray(override: NonNullable> = []): NonNullable { return [ ...faker.helpers.arrayElements([createUser()]) as any, ...override, diff --git a/examples/msw/src/gen/mocks/petMocks/createAddPet.ts b/examples/msw/src/gen/mocks/petMocks/createAddPet.ts index ca1572b1c..33c0356ec 100644 --- a/examples/msw/src/gen/mocks/petMocks/createAddPet.ts +++ b/examples/msw/src/gen/mocks/petMocks/createAddPet.ts @@ -3,7 +3,7 @@ import { createAddPetRequest } from '../createAddPetRequest' import { createPet } from '../createPet' import type { AddPet405, AddPetMutationRequest, AddPetMutationResponse } from '../../models/AddPet' -export function createAddPet405(override: Partial = {}): NonNullable { +export function createAddPet405(override: NonNullable> = {}): NonNullable { return { ...{ 'code': faker.number.float({}), 'message': faker.string.alpha() }, ...override, @@ -13,13 +13,13 @@ export function createAddPet405(override: Partial = {}): NonNullable< * @description Create a new pet in the store */ -export function createAddPetMutationRequest(override?: Partial): NonNullable { +export function createAddPetMutationRequest(override?: NonNullable>): NonNullable { return createAddPetRequest(override) } /** * @description Successful operation */ -export function createAddPetMutationResponse(override?: Partial): NonNullable { +export function createAddPetMutationResponse(override?: NonNullable>): NonNullable { return createPet(override) } diff --git a/examples/msw/src/gen/mocks/petMocks/createDeletePet.ts b/examples/msw/src/gen/mocks/petMocks/createDeletePet.ts index 4ab92ff5e..75062aac2 100644 --- a/examples/msw/src/gen/mocks/petMocks/createDeletePet.ts +++ b/examples/msw/src/gen/mocks/petMocks/createDeletePet.ts @@ -5,22 +5,22 @@ import type { DeletePet400, DeletePetHeaderParams, DeletePetMutationResponse, De * @description Invalid pet value */ -export function createDeletePet400(override?: Partial): NonNullable { +export function createDeletePet400(override?: NonNullable>): NonNullable { return undefined } -export function createDeletePetHeaderParams(override: Partial = {}): NonNullable { +export function createDeletePetHeaderParams(override: NonNullable> = {}): NonNullable { return { ...{ 'api_key': faker.string.alpha() }, ...override, } } -export function createDeletePetMutationResponse(override?: Partial): NonNullable { +export function createDeletePetMutationResponse(override?: NonNullable>): NonNullable { return undefined } -export function createDeletePetPathParams(override: Partial = {}): NonNullable { +export function createDeletePetPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, diff --git a/examples/msw/src/gen/mocks/petMocks/createFindPetsByStatus.ts b/examples/msw/src/gen/mocks/petMocks/createFindPetsByStatus.ts index 103f33166..b374c5676 100644 --- a/examples/msw/src/gen/mocks/petMocks/createFindPetsByStatus.ts +++ b/examples/msw/src/gen/mocks/petMocks/createFindPetsByStatus.ts @@ -6,11 +6,11 @@ import type { FindPetsByStatus400, FindPetsByStatusQueryParams, FindPetsByStatus * @description Invalid status value */ -export function createFindPetsByStatus400(override?: Partial): NonNullable { +export function createFindPetsByStatus400(override?: NonNullable>): NonNullable { return undefined } -export function createFindPetsByStatusQueryParams(override: Partial = {}): NonNullable { +export function createFindPetsByStatusQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'status': faker.helpers.arrayElement([`available`, `pending`, `sold`]) }, ...override, @@ -20,7 +20,9 @@ export function createFindPetsByStatusQueryParams(override: Partial = []): NonNullable { +export function createFindPetsByStatusQueryResponse( + override: NonNullable> = [], +): NonNullable { return [ ...faker.helpers.arrayElements([createPet()]) as any, ...override, diff --git a/examples/msw/src/gen/mocks/petMocks/createFindPetsByTags.ts b/examples/msw/src/gen/mocks/petMocks/createFindPetsByTags.ts index e473fd024..2074a980c 100644 --- a/examples/msw/src/gen/mocks/petMocks/createFindPetsByTags.ts +++ b/examples/msw/src/gen/mocks/petMocks/createFindPetsByTags.ts @@ -6,11 +6,11 @@ import type { FindPetsByTags400, FindPetsByTagsQueryParams, FindPetsByTagsQueryR * @description Invalid tag value */ -export function createFindPetsByTags400(override?: Partial): NonNullable { +export function createFindPetsByTags400(override?: NonNullable>): NonNullable { return undefined } -export function createFindPetsByTagsQueryParams(override: Partial = {}): NonNullable { +export function createFindPetsByTagsQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'tags': faker.helpers.arrayElements([faker.string.alpha()]) as any, 'page': faker.string.alpha(), 'pageSize': faker.string.alpha() }, ...override, @@ -20,7 +20,7 @@ export function createFindPetsByTagsQueryParams(override: Partial = []): NonNullable { +export function createFindPetsByTagsQueryResponse(override: NonNullable> = []): NonNullable { return [ ...faker.helpers.arrayElements([createPet()]) as any, ...override, diff --git a/examples/msw/src/gen/mocks/petMocks/createGetPetById.ts b/examples/msw/src/gen/mocks/petMocks/createGetPetById.ts index a98563b72..ca9ee9e71 100644 --- a/examples/msw/src/gen/mocks/petMocks/createGetPetById.ts +++ b/examples/msw/src/gen/mocks/petMocks/createGetPetById.ts @@ -6,18 +6,18 @@ import type { GetPetById400, GetPetById404, GetPetByIdPathParams, GetPetByIdQuer * @description Invalid ID supplied */ -export function createGetPetById400(override?: Partial): NonNullable { +export function createGetPetById400(override?: NonNullable>): NonNullable { return undefined } /** * @description Pet not found */ -export function createGetPetById404(override?: Partial): NonNullable { +export function createGetPetById404(override?: NonNullable>): NonNullable { return undefined } -export function createGetPetByIdPathParams(override: Partial = {}): NonNullable { +export function createGetPetByIdPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, @@ -27,6 +27,6 @@ export function createGetPetByIdPathParams(override: Partial): NonNullable { +export function createGetPetByIdQueryResponse(override?: NonNullable>): NonNullable { return createPet(override) } diff --git a/examples/msw/src/gen/mocks/petMocks/createUpdatePet.ts b/examples/msw/src/gen/mocks/petMocks/createUpdatePet.ts index dfa69bf0e..db82187a5 100644 --- a/examples/msw/src/gen/mocks/petMocks/createUpdatePet.ts +++ b/examples/msw/src/gen/mocks/petMocks/createUpdatePet.ts @@ -5,34 +5,34 @@ import type { UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutationRequest * @description Invalid ID supplied */ -export function createUpdatePet400(override?: Partial): NonNullable { +export function createUpdatePet400(override?: NonNullable>): NonNullable { return undefined } /** * @description Pet not found */ -export function createUpdatePet404(override?: Partial): NonNullable { +export function createUpdatePet404(override?: NonNullable>): NonNullable { return undefined } /** * @description Validation exception */ -export function createUpdatePet405(override?: Partial): NonNullable { +export function createUpdatePet405(override?: NonNullable>): NonNullable { return undefined } /** * @description Update an existent pet in the store */ -export function createUpdatePetMutationRequest(override?: Partial): NonNullable { +export function createUpdatePetMutationRequest(override?: NonNullable>): NonNullable { return createPet(override) } /** * @description Successful operation */ -export function createUpdatePetMutationResponse(override?: Partial): NonNullable { +export function createUpdatePetMutationResponse(override?: NonNullable>): NonNullable { return createPet(override) } diff --git a/examples/msw/src/gen/mocks/petMocks/createUpdatePetWithForm.ts b/examples/msw/src/gen/mocks/petMocks/createUpdatePetWithForm.ts index 4eb50cfe6..fba9664c3 100644 --- a/examples/msw/src/gen/mocks/petMocks/createUpdatePetWithForm.ts +++ b/examples/msw/src/gen/mocks/petMocks/createUpdatePetWithForm.ts @@ -10,22 +10,26 @@ import type { * @description Invalid input */ -export function createUpdatePetWithForm405(override?: Partial): NonNullable { +export function createUpdatePetWithForm405(override?: NonNullable>): NonNullable { return undefined } -export function createUpdatePetWithFormMutationResponse(override?: Partial): NonNullable { +export function createUpdatePetWithFormMutationResponse( + override?: NonNullable>, +): NonNullable { return undefined } -export function createUpdatePetWithFormPathParams(override: Partial = {}): NonNullable { +export function createUpdatePetWithFormPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, } } -export function createUpdatePetWithFormQueryParams(override: Partial = {}): NonNullable { +export function createUpdatePetWithFormQueryParams( + override: NonNullable> = {}, +): NonNullable { return { ...{ 'name': faker.string.alpha(), 'status': faker.string.alpha() }, ...override, diff --git a/examples/msw/src/gen/mocks/petMocks/createUploadFile.ts b/examples/msw/src/gen/mocks/petMocks/createUploadFile.ts index 39dfc1f24..136424cdd 100644 --- a/examples/msw/src/gen/mocks/petMocks/createUploadFile.ts +++ b/examples/msw/src/gen/mocks/petMocks/createUploadFile.ts @@ -2,18 +2,18 @@ import { faker } from '@faker-js/faker' import { createApiResponse } from '../createApiResponse' import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../../models/UploadFile' -export function createUploadFileMutationRequest(override?: Partial): NonNullable { +export function createUploadFileMutationRequest(override?: NonNullable>): NonNullable { return faker.string.alpha() } -export function createUploadFilePathParams(override: Partial = {}): NonNullable { +export function createUploadFilePathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'petId': faker.number.float({}) }, ...override, } } -export function createUploadFileQueryParams(override: Partial = {}): NonNullable { +export function createUploadFileQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'additionalMetadata': faker.string.alpha() }, ...override, @@ -23,6 +23,6 @@ export function createUploadFileQueryParams(override: Partial): NonNullable { +export function createUploadFileMutationResponse(override?: NonNullable>): NonNullable { return createApiResponse(override) } diff --git a/examples/msw/src/gen/mocks/storeMocks/createDeleteOrder.ts b/examples/msw/src/gen/mocks/storeMocks/createDeleteOrder.ts index 26b0116b8..bbb75a4fd 100644 --- a/examples/msw/src/gen/mocks/storeMocks/createDeleteOrder.ts +++ b/examples/msw/src/gen/mocks/storeMocks/createDeleteOrder.ts @@ -5,22 +5,22 @@ import type { DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, Delet * @description Invalid ID supplied */ -export function createDeleteOrder400(override?: Partial): NonNullable { +export function createDeleteOrder400(override?: NonNullable>): NonNullable { return undefined } /** * @description Order not found */ -export function createDeleteOrder404(override?: Partial): NonNullable { +export function createDeleteOrder404(override?: NonNullable>): NonNullable { return undefined } -export function createDeleteOrderMutationResponse(override?: Partial): NonNullable { +export function createDeleteOrderMutationResponse(override?: NonNullable>): NonNullable { return undefined } -export function createDeleteOrderPathParams(override: Partial = {}): NonNullable { +export function createDeleteOrderPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'orderId': faker.number.float({}) }, ...override, diff --git a/examples/msw/src/gen/mocks/storeMocks/createGetInventory.ts b/examples/msw/src/gen/mocks/storeMocks/createGetInventory.ts index d20606b9c..7ebf82f0c 100644 --- a/examples/msw/src/gen/mocks/storeMocks/createGetInventory.ts +++ b/examples/msw/src/gen/mocks/storeMocks/createGetInventory.ts @@ -4,7 +4,7 @@ import type { GetInventoryQueryResponse } from '../../models/GetInventory' * @description successful operation */ -export function createGetInventoryQueryResponse(override: Partial = {}): NonNullable { +export function createGetInventoryQueryResponse(override: NonNullable> = {}): NonNullable { return { ...{}, ...override, diff --git a/examples/msw/src/gen/mocks/storeMocks/createGetOrderById.ts b/examples/msw/src/gen/mocks/storeMocks/createGetOrderById.ts index b36d7a87b..e0e9829db 100644 --- a/examples/msw/src/gen/mocks/storeMocks/createGetOrderById.ts +++ b/examples/msw/src/gen/mocks/storeMocks/createGetOrderById.ts @@ -6,18 +6,18 @@ import type { GetOrderById400, GetOrderById404, GetOrderByIdPathParams, GetOrder * @description Invalid ID supplied */ -export function createGetOrderById400(override?: Partial): NonNullable { +export function createGetOrderById400(override?: NonNullable>): NonNullable { return undefined } /** * @description Order not found */ -export function createGetOrderById404(override?: Partial): NonNullable { +export function createGetOrderById404(override?: NonNullable>): NonNullable { return undefined } -export function createGetOrderByIdPathParams(override: Partial = {}): NonNullable { +export function createGetOrderByIdPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'orderId': faker.number.float({}) }, ...override, @@ -27,6 +27,6 @@ export function createGetOrderByIdPathParams(override: Partial): NonNullable { +export function createGetOrderByIdQueryResponse(override?: NonNullable>): NonNullable { return createOrder(override) } diff --git a/examples/msw/src/gen/mocks/storeMocks/createPlaceOrder.ts b/examples/msw/src/gen/mocks/storeMocks/createPlaceOrder.ts index fb032bfa3..4c7637a27 100644 --- a/examples/msw/src/gen/mocks/storeMocks/createPlaceOrder.ts +++ b/examples/msw/src/gen/mocks/storeMocks/createPlaceOrder.ts @@ -5,17 +5,17 @@ import type { PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationRespon * @description Invalid input */ -export function createPlaceOrder405(override?: Partial): NonNullable { +export function createPlaceOrder405(override?: NonNullable>): NonNullable { return undefined } -export function createPlaceOrderMutationRequest(override?: Partial): NonNullable { +export function createPlaceOrderMutationRequest(override?: NonNullable>): NonNullable { return createOrder(override) } /** * @description successful operation */ -export function createPlaceOrderMutationResponse(override?: Partial): NonNullable { +export function createPlaceOrderMutationResponse(override?: NonNullable>): NonNullable { return createOrder(override) } diff --git a/examples/msw/src/gen/mocks/storeMocks/createPlaceOrderPatch.ts b/examples/msw/src/gen/mocks/storeMocks/createPlaceOrderPatch.ts index 2bbe3b2bd..08825538c 100644 --- a/examples/msw/src/gen/mocks/storeMocks/createPlaceOrderPatch.ts +++ b/examples/msw/src/gen/mocks/storeMocks/createPlaceOrderPatch.ts @@ -5,17 +5,21 @@ import type { PlaceOrderPatch405, PlaceOrderPatchMutationRequest, PlaceOrderPatc * @description Invalid input */ -export function createPlaceOrderPatch405(override?: Partial): NonNullable { +export function createPlaceOrderPatch405(override?: NonNullable>): NonNullable { return undefined } -export function createPlaceOrderPatchMutationRequest(override?: Partial): NonNullable { +export function createPlaceOrderPatchMutationRequest( + override?: NonNullable>, +): NonNullable { return createOrder(override) } /** * @description successful operation */ -export function createPlaceOrderPatchMutationResponse(override?: Partial): NonNullable { +export function createPlaceOrderPatchMutationResponse( + override?: NonNullable>, +): NonNullable { return createOrder(override) } diff --git a/examples/msw/src/gen/mocks/userMocks/createCreateUser.ts b/examples/msw/src/gen/mocks/userMocks/createCreateUser.ts index 77a8fef09..0e48bfdb5 100644 --- a/examples/msw/src/gen/mocks/userMocks/createCreateUser.ts +++ b/examples/msw/src/gen/mocks/userMocks/createCreateUser.ts @@ -1,20 +1,13 @@ import { createUser } from '../createUser' -import type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/CreateUser' -export function createCreateUserMutationResponse(override?: Partial): NonNullable { +export function createCreateUserMutationResponse(override?: NonNullable>): NonNullable { return undefined } -/** - * @description successful operation - */ - -export function createCreateUserError(override?: Partial): NonNullable { - return createUser(override) -} /** * @description Created user object */ -export function createCreateUserMutationRequest(override?: Partial): NonNullable { +export function createCreateUserMutationRequest(override?: NonNullable>): NonNullable { return createUser(override) } diff --git a/examples/msw/src/gen/mocks/userMocks/createCreateUsersWithListInput.ts b/examples/msw/src/gen/mocks/userMocks/createCreateUsersWithListInput.ts index 2365fda3a..72c3d4c9e 100644 --- a/examples/msw/src/gen/mocks/userMocks/createCreateUsersWithListInput.ts +++ b/examples/msw/src/gen/mocks/userMocks/createCreateUsersWithListInput.ts @@ -1,21 +1,9 @@ import { faker } from '@faker-js/faker' import { createUser } from '../createUser' -import type { - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, -} from '../../models/CreateUsersWithListInput' - -/** - * @description successful operation - */ - -export function createCreateUsersWithListInputError(override?: Partial): NonNullable { - return undefined -} +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../../models/CreateUsersWithListInput' export function createCreateUsersWithListInputMutationRequest( - override: Partial = [], + override: NonNullable> = [], ): NonNullable { return [ ...faker.helpers.arrayElements([createUser()]) as any, @@ -27,7 +15,7 @@ export function createCreateUsersWithListInputMutationRequest( */ export function createCreateUsersWithListInputMutationResponse( - override?: Partial, + override?: NonNullable>, ): NonNullable { return createUser(override) } diff --git a/examples/msw/src/gen/mocks/userMocks/createDeleteUser.ts b/examples/msw/src/gen/mocks/userMocks/createDeleteUser.ts index d37736c0d..e16d46d40 100644 --- a/examples/msw/src/gen/mocks/userMocks/createDeleteUser.ts +++ b/examples/msw/src/gen/mocks/userMocks/createDeleteUser.ts @@ -5,22 +5,22 @@ import type { DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUs * @description Invalid username supplied */ -export function createDeleteUser400(override?: Partial): NonNullable { +export function createDeleteUser400(override?: NonNullable>): NonNullable { return undefined } /** * @description User not found */ -export function createDeleteUser404(override?: Partial): NonNullable { +export function createDeleteUser404(override?: NonNullable>): NonNullable { return undefined } -export function createDeleteUserMutationResponse(override?: Partial): NonNullable { +export function createDeleteUserMutationResponse(override?: NonNullable>): NonNullable { return undefined } -export function createDeleteUserPathParams(override: Partial = {}): NonNullable { +export function createDeleteUserPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'username': faker.string.alpha() }, ...override, diff --git a/examples/msw/src/gen/mocks/userMocks/createGetUserByName.ts b/examples/msw/src/gen/mocks/userMocks/createGetUserByName.ts index 7085fedef..37bf51d97 100644 --- a/examples/msw/src/gen/mocks/userMocks/createGetUserByName.ts +++ b/examples/msw/src/gen/mocks/userMocks/createGetUserByName.ts @@ -6,18 +6,18 @@ import type { GetUserByName400, GetUserByName404, GetUserByNamePathParams, GetUs * @description Invalid username supplied */ -export function createGetUserByName400(override?: Partial): NonNullable { +export function createGetUserByName400(override?: NonNullable>): NonNullable { return undefined } /** * @description User not found */ -export function createGetUserByName404(override?: Partial): NonNullable { +export function createGetUserByName404(override?: NonNullable>): NonNullable { return undefined } -export function createGetUserByNamePathParams(override: Partial = {}): NonNullable { +export function createGetUserByNamePathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'username': faker.string.alpha() }, ...override, @@ -27,6 +27,6 @@ export function createGetUserByNamePathParams(override: Partial): NonNullable { +export function createGetUserByNameQueryResponse(override?: NonNullable>): NonNullable { return createUser(override) } diff --git a/examples/msw/src/gen/mocks/userMocks/createLoginUser.ts b/examples/msw/src/gen/mocks/userMocks/createLoginUser.ts index bc525c16f..3b2eb5cb8 100644 --- a/examples/msw/src/gen/mocks/userMocks/createLoginUser.ts +++ b/examples/msw/src/gen/mocks/userMocks/createLoginUser.ts @@ -5,11 +5,11 @@ import type { LoginUser400, LoginUserQueryParams, LoginUserQueryResponse } from * @description Invalid username/password supplied */ -export function createLoginUser400(override?: Partial): NonNullable { +export function createLoginUser400(override?: NonNullable>): NonNullable { return undefined } -export function createLoginUserQueryParams(override: Partial = {}): NonNullable { +export function createLoginUserQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ 'username': faker.string.alpha(), 'password': faker.internet.password() }, ...override, @@ -19,6 +19,6 @@ export function createLoginUserQueryParams(override: Partial): NonNullable { +export function createLoginUserQueryResponse(override?: NonNullable>): NonNullable { return faker.string.alpha() } diff --git a/examples/msw/src/gen/mocks/userMocks/createLogoutUser.ts b/examples/msw/src/gen/mocks/userMocks/createLogoutUser.ts index b8e7c4c53..26bf1557c 100644 --- a/examples/msw/src/gen/mocks/userMocks/createLogoutUser.ts +++ b/examples/msw/src/gen/mocks/userMocks/createLogoutUser.ts @@ -1,13 +1,5 @@ -import type { LogoutUserError, LogoutUserQueryResponse } from '../../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../../models/LogoutUser' -/** - * @description successful operation - */ - -export function createLogoutUserError(override?: Partial): NonNullable { - return undefined -} - -export function createLogoutUserQueryResponse(override?: Partial): NonNullable { +export function createLogoutUserQueryResponse(override?: NonNullable>): NonNullable { return undefined } diff --git a/examples/msw/src/gen/mocks/userMocks/createUpdateUser.ts b/examples/msw/src/gen/mocks/userMocks/createUpdateUser.ts index 764de089c..99cf274da 100644 --- a/examples/msw/src/gen/mocks/userMocks/createUpdateUser.ts +++ b/examples/msw/src/gen/mocks/userMocks/createUpdateUser.ts @@ -1,20 +1,12 @@ import { faker } from '@faker-js/faker' import { createUser } from '../createUser' -import type { UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/UpdateUser' -/** - * @description successful operation - */ - -export function createUpdateUserError(override?: Partial): NonNullable { - return undefined -} - -export function createUpdateUserMutationResponse(override?: Partial): NonNullable { +export function createUpdateUserMutationResponse(override?: NonNullable>): NonNullable { return undefined } -export function createUpdateUserPathParams(override: Partial = {}): NonNullable { +export function createUpdateUserPathParams(override: NonNullable> = {}): NonNullable { return { ...{ 'username': faker.string.alpha() }, ...override, @@ -24,6 +16,6 @@ export function createUpdateUserPathParams(override: Partial): NonNullable { +export function createUpdateUserMutationRequest(override?: NonNullable>): NonNullable { return createUser(override) } diff --git a/examples/msw/src/gen/models/CreateUser.ts b/examples/msw/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/msw/src/gen/models/CreateUser.ts +++ b/examples/msw/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/msw/src/gen/models/CreateUsersWithListInput.ts b/examples/msw/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/msw/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/msw/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/msw/src/gen/models/LogoutUser.ts b/examples/msw/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/msw/src/gen/models/LogoutUser.ts +++ b/examples/msw/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/msw/src/gen/models/UpdateUser.ts b/examples/msw/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/msw/src/gen/models/UpdateUser.ts +++ b/examples/msw/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/react-query-v5/kubb.config.js b/examples/react-query-v5/kubb.config.js index c31196227..c6db52c27 100644 --- a/examples/react-query-v5/kubb.config.js +++ b/examples/react-query-v5/kubb.config.js @@ -36,6 +36,9 @@ export const config = { path: './hooks', }, framework: 'react', + query: { + queryKey: (keys) => ['"v5"', ...keys], + }, suspense: {}, override: [{ type: 'operationId', diff --git a/examples/react-query-v5/package.json b/examples/react-query-v5/package.json index 381b34844..8f6aa9f4b 100644 --- a/examples/react-query-v5/package.json +++ b/examples/react-query-v5/package.json @@ -29,16 +29,16 @@ "@kubb/swagger-client": "workspace:*", "@kubb/swagger-tanstack-query": "workspace:*", "@kubb/swagger-ts": "workspace:*", - "@tanstack/react-query": "^5.18.1", + "@tanstack/react-query": "^5.21.7", "@tanstack/react-query-devtools": "5.0.0", "axios": "^1.6.7", "react": "^18.2.0", "react-dom": "^18.2.0", - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "devDependencies": { - "@types/react": "^18.2.52", - "@types/react-dom": "^18.2.18", + "@types/react": "^18.2.56", + "@types/react-dom": "^18.2.19", "@vitejs/plugin-react": "^4.2.1", "msw": "^1.3.2", "typescript": "~5.2.2", diff --git a/examples/react-query-v5/src/gen/hooks/useCreateUserHook.ts b/examples/react-query-v5/src/gen/hooks/useCreateUserHook.ts index b71c33b71..090f2f4cb 100644 --- a/examples/react-query-v5/src/gen/hooks/useCreateUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useCreateUserHook.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/react-query' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' import type { UseMutationOptions } from '@tanstack/react-query' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/react-query-v5/src/gen/hooks/useCreateUsersWithListInputHook.ts b/examples/react-query-v5/src/gen/hooks/useCreateUsersWithListInputHook.ts index 9cbab6bb7..712ab7678 100644 --- a/examples/react-query-v5/src/gen/hooks/useCreateUsersWithListInputHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useCreateUsersWithListInputHook.ts @@ -1,20 +1,12 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/react-query' -import type { - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, -} from '../models/CreateUsersWithListInput' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' import type { UseMutationOptions } from '@tanstack/react-query' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/react-query-v5/src/gen/hooks/useFindPetsByStatusHook.ts b/examples/react-query-v5/src/gen/hooks/useFindPetsByStatusHook.ts index 2d79dbf83..2454689b8 100644 --- a/examples/react-query-v5/src/gen/hooks/useFindPetsByStatusHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useFindPetsByStatusHook.ts @@ -17,7 +17,7 @@ type FindPetsByStatus = { return: Awaited> } } -export const findPetsByStatusQueryKey = (params?: FindPetsByStatus['queryParams']) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const +export const findPetsByStatusQueryKey = (params?: FindPetsByStatus['queryParams']) => ['v5', { url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const export type FindPetsByStatusQueryKey = ReturnType export function findPetsByStatusQueryOptions(params?: FindPetsByStatus['queryParams'], options: FindPetsByStatus['client']['parameters'] = {}) { const queryKey = findPetsByStatusQueryKey(params) @@ -53,7 +53,7 @@ export function useFindPetsByStatusHook< const query = useQuery({ ...findPetsByStatusQueryOptions(params, clientOptions) as QueryObserverOptions, queryKey, - ...queryOptions as unknown as QueryObserverOptions, + ...queryOptions as unknown as Omit, }) as UseQueryResult & { queryKey: TQueryKey } @@ -61,7 +61,7 @@ export function useFindPetsByStatusHook< return query } export const findPetsByStatusSuspenseQueryKey = (params?: FindPetsByStatus['queryParams']) => - [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const + ['v5', { url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const export type FindPetsByStatusSuspenseQueryKey = ReturnType export function findPetsByStatusSuspenseQueryOptions(params?: FindPetsByStatus['queryParams'], options: FindPetsByStatus['client']['parameters'] = {}) { const queryKey = findPetsByStatusSuspenseQueryKey(params) @@ -96,7 +96,7 @@ export function useFindPetsByStatusHookSuspense, }) as UseSuspenseQueryResult & { queryKey: TQueryKey } diff --git a/examples/react-query-v5/src/gen/hooks/useFindPetsByTagsHook.ts b/examples/react-query-v5/src/gen/hooks/useFindPetsByTagsHook.ts index 91edb9f61..8ecd98cdd 100644 --- a/examples/react-query-v5/src/gen/hooks/useFindPetsByTagsHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useFindPetsByTagsHook.ts @@ -26,7 +26,7 @@ type FindPetsByTags = { return: Awaited> } } -export const findPetsByTagsQueryKey = (params?: FindPetsByTags['queryParams']) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const +export const findPetsByTagsQueryKey = (params?: FindPetsByTags['queryParams']) => ['v5', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const export type FindPetsByTagsQueryKey = ReturnType export function findPetsByTagsQueryOptions(params?: FindPetsByTags['queryParams'], options: FindPetsByTags['client']['parameters'] = {}) { const queryKey = findPetsByTagsQueryKey(params) @@ -62,14 +62,15 @@ export function useFindPetsByTagsHook< const query = useQuery({ ...findPetsByTagsQueryOptions(params, clientOptions) as QueryObserverOptions, queryKey, - ...queryOptions as unknown as QueryObserverOptions, + ...queryOptions as unknown as Omit, }) as UseQueryResult & { queryKey: TQueryKey } query.queryKey = queryKey as TQueryKey return query } -export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTags['queryParams']) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const +export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTags['queryParams']) => + ['v5', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const export type FindPetsByTagsInfiniteQueryKey = ReturnType export function findPetsByTagsInfiniteQueryOptions(params?: FindPetsByTags['queryParams'], options: FindPetsByTags['client']['parameters'] = {}) { const queryKey = findPetsByTagsInfiniteQueryKey(params) @@ -112,14 +113,15 @@ export function useFindPetsByTagsHookInfinite< const query = useInfiniteQuery({ ...findPetsByTagsInfiniteQueryOptions(params, clientOptions) as InfiniteQueryObserverOptions, queryKey, - ...queryOptions as unknown as InfiniteQueryObserverOptions, + ...queryOptions as unknown as Omit, }) as UseInfiniteQueryResult & { queryKey: TQueryKey } query.queryKey = queryKey as TQueryKey return query } -export const findPetsByTagsSuspenseQueryKey = (params?: FindPetsByTags['queryParams']) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const +export const findPetsByTagsSuspenseQueryKey = (params?: FindPetsByTags['queryParams']) => + ['v5', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const export type FindPetsByTagsSuspenseQueryKey = ReturnType export function findPetsByTagsSuspenseQueryOptions(params?: FindPetsByTags['queryParams'], options: FindPetsByTags['client']['parameters'] = {}) { const queryKey = findPetsByTagsSuspenseQueryKey(params) @@ -154,7 +156,7 @@ export function useFindPetsByTagsHookSuspense, }) as UseSuspenseQueryResult & { queryKey: TQueryKey } diff --git a/examples/react-query-v5/src/gen/hooks/useGetInventoryHook.ts b/examples/react-query-v5/src/gen/hooks/useGetInventoryHook.ts index 3385e2957..5c029de22 100644 --- a/examples/react-query-v5/src/gen/hooks/useGetInventoryHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useGetInventoryHook.ts @@ -17,7 +17,7 @@ type GetInventory = { return: Awaited> } } -export const getInventoryQueryKey = () => [{ url: '/store/inventory' }] as const +export const getInventoryQueryKey = () => ['v5', { url: '/store/inventory' }] as const export type GetInventoryQueryKey = ReturnType export function getInventoryQueryOptions(options: GetInventory['client']['parameters'] = {}) { const queryKey = getInventoryQueryKey() @@ -50,14 +50,14 @@ export function useGetInventoryHook, }) as UseQueryResult & { queryKey: TQueryKey } query.queryKey = queryKey as TQueryKey return query } -export const getInventorySuspenseQueryKey = () => [{ url: '/store/inventory' }] as const +export const getInventorySuspenseQueryKey = () => ['v5', { url: '/store/inventory' }] as const export type GetInventorySuspenseQueryKey = ReturnType export function getInventorySuspenseQueryOptions(options: GetInventory['client']['parameters'] = {}) { const queryKey = getInventorySuspenseQueryKey() @@ -88,7 +88,7 @@ export function useGetInventoryHookSuspense, }) as UseSuspenseQueryResult & { queryKey: TQueryKey } diff --git a/examples/react-query-v5/src/gen/hooks/useGetOrderByIdHook.ts b/examples/react-query-v5/src/gen/hooks/useGetOrderByIdHook.ts index a1d527edc..518d47da0 100644 --- a/examples/react-query-v5/src/gen/hooks/useGetOrderByIdHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useGetOrderByIdHook.ts @@ -17,7 +17,8 @@ type GetOrderById = { return: Awaited> } } -export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const +export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => + ['v5', { url: '/store/order/:orderId', params: { orderId: orderId } }] as const export type GetOrderByIdQueryKey = ReturnType export function getOrderByIdQueryOptions(orderId: GetOrderByIdPathParams['orderId'], options: GetOrderById['client']['parameters'] = {}) { const queryKey = getOrderByIdQueryKey(orderId) @@ -51,7 +52,7 @@ export function useGetOrderByIdHook, }) as UseQueryResult & { queryKey: TQueryKey } @@ -59,7 +60,7 @@ export function useGetOrderByIdHook - [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const + ['v5', { url: '/store/order/:orderId', params: { orderId: orderId } }] as const export type GetOrderByIdSuspenseQueryKey = ReturnType export function getOrderByIdSuspenseQueryOptions(orderId: GetOrderByIdPathParams['orderId'], options: GetOrderById['client']['parameters'] = {}) { const queryKey = getOrderByIdSuspenseQueryKey(orderId) @@ -93,7 +94,7 @@ export function useGetOrderByIdHookSuspense, }) as UseSuspenseQueryResult & { queryKey: TQueryKey } diff --git a/examples/react-query-v5/src/gen/hooks/useGetPetByIdHook.ts b/examples/react-query-v5/src/gen/hooks/useGetPetByIdHook.ts index b97ecb730..81fc8cc85 100644 --- a/examples/react-query-v5/src/gen/hooks/useGetPetByIdHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useGetPetByIdHook.ts @@ -17,7 +17,7 @@ type GetPetById = { return: Awaited> } } -export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const +export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => ['v5', { url: '/pet/:petId', params: { petId: petId } }] as const export type GetPetByIdQueryKey = ReturnType export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['petId'], options: GetPetById['client']['parameters'] = {}) { const queryKey = getPetByIdQueryKey(petId) @@ -51,14 +51,14 @@ export function useGetPetByIdHook, }) as UseQueryResult & { queryKey: TQueryKey } query.queryKey = queryKey as TQueryKey return query } -export const getPetByIdSuspenseQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const +export const getPetByIdSuspenseQueryKey = (petId: GetPetByIdPathParams['petId']) => ['v5', { url: '/pet/:petId', params: { petId: petId } }] as const export type GetPetByIdSuspenseQueryKey = ReturnType export function getPetByIdSuspenseQueryOptions(petId: GetPetByIdPathParams['petId'], options: GetPetById['client']['parameters'] = {}) { const queryKey = getPetByIdSuspenseQueryKey(petId) @@ -92,7 +92,7 @@ export function useGetPetByIdHookSuspense, }) as UseSuspenseQueryResult & { queryKey: TQueryKey } diff --git a/examples/react-query-v5/src/gen/hooks/useGetUserByNameHook.ts b/examples/react-query-v5/src/gen/hooks/useGetUserByNameHook.ts index c8370047b..92a7e10ef 100644 --- a/examples/react-query-v5/src/gen/hooks/useGetUserByNameHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useGetUserByNameHook.ts @@ -17,7 +17,8 @@ type GetUserByName = { return: Awaited> } } -export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: '/user/:username', params: { username: username } }] as const +export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => + ['v5', { url: '/user/:username', params: { username: username } }] as const export type GetUserByNameQueryKey = ReturnType export function getUserByNameQueryOptions(username: GetUserByNamePathParams['username'], options: GetUserByName['client']['parameters'] = {}) { const queryKey = getUserByNameQueryKey(username) @@ -51,7 +52,7 @@ export function useGetUserByNameHook< const query = useQuery({ ...getUserByNameQueryOptions(username, clientOptions) as QueryObserverOptions, queryKey, - ...queryOptions as unknown as QueryObserverOptions, + ...queryOptions as unknown as Omit, }) as UseQueryResult & { queryKey: TQueryKey } @@ -59,7 +60,7 @@ export function useGetUserByNameHook< return query } export const getUserByNameSuspenseQueryKey = (username: GetUserByNamePathParams['username']) => - [{ url: '/user/:username', params: { username: username } }] as const + ['v5', { url: '/user/:username', params: { username: username } }] as const export type GetUserByNameSuspenseQueryKey = ReturnType export function getUserByNameSuspenseQueryOptions(username: GetUserByNamePathParams['username'], options: GetUserByName['client']['parameters'] = {}) { const queryKey = getUserByNameSuspenseQueryKey(username) @@ -92,7 +93,7 @@ export function useGetUserByNameHookSuspense, }) as UseSuspenseQueryResult & { queryKey: TQueryKey } diff --git a/examples/react-query-v5/src/gen/hooks/useLoginUserHook.ts b/examples/react-query-v5/src/gen/hooks/useLoginUserHook.ts index 9424016be..f289a0b0d 100644 --- a/examples/react-query-v5/src/gen/hooks/useLoginUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useLoginUserHook.ts @@ -17,7 +17,7 @@ type LoginUser = { return: Awaited> } } -export const loginUserQueryKey = (params?: LoginUser['queryParams']) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const +export const loginUserQueryKey = (params?: LoginUser['queryParams']) => ['v5', { url: '/user/login' }, ...(params ? [params] : [])] as const export type LoginUserQueryKey = ReturnType export function loginUserQueryOptions(params?: LoginUser['queryParams'], options: LoginUser['client']['parameters'] = {}) { const queryKey = loginUserQueryKey(params) @@ -51,14 +51,14 @@ export function useLoginUserHook, }) as UseQueryResult & { queryKey: TQueryKey } query.queryKey = queryKey as TQueryKey return query } -export const loginUserSuspenseQueryKey = (params?: LoginUser['queryParams']) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const +export const loginUserSuspenseQueryKey = (params?: LoginUser['queryParams']) => ['v5', { url: '/user/login' }, ...(params ? [params] : [])] as const export type LoginUserSuspenseQueryKey = ReturnType export function loginUserSuspenseQueryOptions(params?: LoginUser['queryParams'], options: LoginUser['client']['parameters'] = {}) { const queryKey = loginUserSuspenseQueryKey(params) @@ -92,7 +92,7 @@ export function useLoginUserHookSuspense, }) as UseSuspenseQueryResult & { queryKey: TQueryKey } diff --git a/examples/react-query-v5/src/gen/hooks/useLogoutUserHook.ts b/examples/react-query-v5/src/gen/hooks/useLogoutUserHook.ts index e3afe0045..006039c0f 100644 --- a/examples/react-query-v5/src/gen/hooks/useLogoutUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useLogoutUserHook.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { useQuery, queryOptions, useSuspenseQuery } from '@tanstack/react-query' -import type { LogoutUserQueryResponse, LogoutUserError } from '../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../models/LogoutUser' import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never @@ -17,7 +17,7 @@ type LogoutUser = { return: Awaited> } } -export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const +export const logoutUserQueryKey = () => ['v5', { url: '/user/logout' }] as const export type LogoutUserQueryKey = ReturnType export function logoutUserQueryOptions(options: LogoutUser['client']['parameters'] = {}) { const queryKey = logoutUserQueryKey() @@ -49,14 +49,14 @@ export function useLogoutUserHook, }) as UseQueryResult & { queryKey: TQueryKey } query.queryKey = queryKey as TQueryKey return query } -export const logoutUserSuspenseQueryKey = () => [{ url: '/user/logout' }] as const +export const logoutUserSuspenseQueryKey = () => ['v5', { url: '/user/logout' }] as const export type LogoutUserSuspenseQueryKey = ReturnType export function logoutUserSuspenseQueryOptions(options: LogoutUser['client']['parameters'] = {}) { const queryKey = logoutUserSuspenseQueryKey() @@ -86,7 +86,7 @@ export function useLogoutUserHookSuspense, }) as UseSuspenseQueryResult & { queryKey: TQueryKey } diff --git a/examples/react-query-v5/src/gen/hooks/useUpdateUserHook.ts b/examples/react-query-v5/src/gen/hooks/useUpdateUserHook.ts index 56fd9be67..17523d215 100644 --- a/examples/react-query-v5/src/gen/hooks/useUpdateUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useUpdateUserHook.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/react-query' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' import type { UseMutationOptions } from '@tanstack/react-query' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/react-query-v5/src/gen/models/CreateUser.ts b/examples/react-query-v5/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/react-query-v5/src/gen/models/CreateUser.ts +++ b/examples/react-query-v5/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts b/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/react-query-v5/src/gen/models/LogoutUser.ts b/examples/react-query-v5/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/react-query-v5/src/gen/models/LogoutUser.ts +++ b/examples/react-query-v5/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/react-query-v5/src/gen/models/UpdateUser.ts b/examples/react-query-v5/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/react-query-v5/src/gen/models/UpdateUser.ts +++ b/examples/react-query-v5/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/react-query/package.json b/examples/react-query/package.json index 9f6379464..ecd9bc986 100644 --- a/examples/react-query/package.json +++ b/examples/react-query/package.json @@ -33,11 +33,11 @@ "axios": "^1.6.7", "react": "^18.2.0", "react-dom": "^18.2.0", - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "devDependencies": { - "@types/react": "^18.2.52", - "@types/react-dom": "^18.2.18", + "@types/react": "^18.2.56", + "@types/react-dom": "^18.2.19", "@vitejs/plugin-react": "^4.2.1", "msw": "^1.3.2", "typescript": "~5.2.2", diff --git a/examples/react-query/src/gen/hooks/useCreateUserHook.ts b/examples/react-query/src/gen/hooks/useCreateUserHook.ts index a1bb7c5dd..9148f232e 100644 --- a/examples/react-query/src/gen/hooks/useCreateUserHook.ts +++ b/examples/react-query/src/gen/hooks/useCreateUserHook.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/react-query' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/react-query/src/gen/hooks/useCreateUsersWithListInputHook.ts b/examples/react-query/src/gen/hooks/useCreateUsersWithListInputHook.ts index fe490128d..062ce7cdd 100644 --- a/examples/react-query/src/gen/hooks/useCreateUsersWithListInputHook.ts +++ b/examples/react-query/src/gen/hooks/useCreateUsersWithListInputHook.ts @@ -1,20 +1,12 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/react-query' -import type { - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, -} from '../models/CreateUsersWithListInput' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/react-query/src/gen/hooks/useLogoutUserHook.ts b/examples/react-query/src/gen/hooks/useLogoutUserHook.ts index 953c7c9b6..cabcadd2d 100644 --- a/examples/react-query/src/gen/hooks/useLogoutUserHook.ts +++ b/examples/react-query/src/gen/hooks/useLogoutUserHook.ts @@ -1,6 +1,6 @@ import client from '@kubb/swagger-client/client' import { useQuery, useInfiniteQuery } from '@tanstack/react-query' -import type { LogoutUserQueryResponse, LogoutUserError } from '../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../models/LogoutUser' import type { UseBaseQueryOptions, UseQueryResult, @@ -11,10 +11,10 @@ import type { InfiniteData, } from '@tanstack/react-query' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never diff --git a/examples/react-query/src/gen/hooks/useUpdateUserHook.ts b/examples/react-query/src/gen/hooks/useUpdateUserHook.ts index dab9b041a..18c4c348c 100644 --- a/examples/react-query/src/gen/hooks/useUpdateUserHook.ts +++ b/examples/react-query/src/gen/hooks/useUpdateUserHook.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/react-query' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/react-query/src/gen/index.ts b/examples/react-query/src/gen/index.ts index 1771e248f..20a2d43f2 100644 --- a/examples/react-query/src/gen/index.ts +++ b/examples/react-query/src/gen/index.ts @@ -9,11 +9,9 @@ export type { Address, ApiResponse, Category, - CreateUserError, CreateUserMutation, CreateUserMutationRequest, CreateUserMutationResponse, - CreateUsersWithListInputError, CreateUsersWithListInputMutation, CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, @@ -63,7 +61,6 @@ export type { LoginUserQuery, LoginUserQueryParams, LoginUserQueryResponse, - LogoutUserError, LogoutUserQuery, LogoutUserQueryResponse, Order, @@ -92,7 +89,6 @@ export type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, - UpdateUserError, UpdateUserMutation, UpdateUserMutationRequest, UpdateUserMutationResponse, diff --git a/examples/react-query/src/gen/models/CreateUser.ts b/examples/react-query/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/react-query/src/gen/models/CreateUser.ts +++ b/examples/react-query/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/react-query/src/gen/models/CreateUsersWithListInput.ts b/examples/react-query/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/react-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/react-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/react-query/src/gen/models/LogoutUser.ts b/examples/react-query/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/react-query/src/gen/models/LogoutUser.ts +++ b/examples/react-query/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/react-query/src/gen/models/UpdateUser.ts b/examples/react-query/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/react-query/src/gen/models/UpdateUser.ts +++ b/examples/react-query/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/react-query/src/gen/models/index.ts b/examples/react-query/src/gen/models/index.ts index db36be12c..0b017fb4b 100644 --- a/examples/react-query/src/gen/models/index.ts +++ b/examples/react-query/src/gen/models/index.ts @@ -4,9 +4,8 @@ export { addPetRequestStatus } from './AddPetRequest' export type { Address } from './Address' export type { ApiResponse } from './ApiResponse' export type { Category } from './Category' -export type { CreateUserError, CreateUserMutation, CreateUserMutationRequest, CreateUserMutationResponse } from './CreateUser' +export type { CreateUserMutation, CreateUserMutationRequest, CreateUserMutationResponse } from './CreateUser' export type { - CreateUsersWithListInputError, CreateUsersWithListInputMutation, CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, @@ -29,7 +28,7 @@ export type { GetOrderById400, GetOrderById404, GetOrderByIdPathParams, GetOrder export type { GetPetById400, GetPetById404, GetPetByIdPathParams, GetPetByIdQuery, GetPetByIdQueryResponse } from './GetPetById' export type { GetUserByName400, GetUserByName404, GetUserByNamePathParams, GetUserByNameQuery, GetUserByNameQueryResponse } from './GetUserByName' export type { LoginUser400, LoginUserQuery, LoginUserQueryParams, LoginUserQueryResponse } from './LoginUser' -export type { LogoutUserError, LogoutUserQuery, LogoutUserQueryResponse } from './LogoutUser' +export type { LogoutUserQuery, LogoutUserQueryResponse } from './LogoutUser' export type { Order, OrderHttpStatus, OrderStatus } from './Order' export { orderHttpStatus, orderStatus } from './Order' export type { Pet, PetStatus } from './Pet' @@ -46,7 +45,7 @@ export type { UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, } from './UpdatePetWithForm' -export type { UpdateUserError, UpdateUserMutation, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from './UpdateUser' +export type { UpdateUserMutation, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from './UpdateUser' export type { UploadFileMutation, UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from './UploadFile' export type { User } from './User' export type { UserArray } from './UserArray' diff --git a/examples/simple-single/kubb.config.js b/examples/simple-single/kubb.config.js index 01b6a814e..bf3e60a01 100644 --- a/examples/simple-single/kubb.config.js +++ b/examples/simple-single/kubb.config.js @@ -2,6 +2,7 @@ import { defineConfig } from '@kubb/core' import createSwagger from '@kubb/swagger' import createSwaggerTanstackQuery from '@kubb/swagger-tanstack-query' import createSwaggerTS from '@kubb/swagger-ts' +import createSwaggerZod from '@kubb/swagger-zod' export default defineConfig({ root: '.', @@ -27,5 +28,10 @@ export default defineConfig({ path: './hooks.ts', }, }), + createSwaggerZod({ + output: { + path: './zod.ts', + }, + }), ], }) diff --git a/examples/simple-single/package.json b/examples/simple-single/package.json index 9dab574be..ecbe85864 100644 --- a/examples/simple-single/package.json +++ b/examples/simple-single/package.json @@ -29,9 +29,11 @@ "@kubb/swagger-client": "workspace:*", "@kubb/swagger-tanstack-query": "workspace:*", "@kubb/swagger-ts": "workspace:*", + "@kubb/swagger-zod": "workspace:*", "@tanstack/react-query": "^4.36.1", "axios": "^1.6.7", "react": "^18.2.0", - "tsup": "^8.0.1" + "tsup": "^8.0.2", + "zod": "^3.22.4" } } diff --git a/examples/simple-single/src/gen/hooks.ts b/examples/simple-single/src/gen/hooks.ts index 8c4e66055..5c28a2559 100644 --- a/examples/simple-single/src/gen/hooks.ts +++ b/examples/simple-single/src/gen/hooks.ts @@ -48,15 +48,12 @@ import type { DeleteOrder404, CreateUserMutationRequest, CreateUserMutationResponse, - CreateUserError, CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, LoginUserQueryResponse, LoginUserQueryParams, LoginUser400, LogoutUserQueryResponse, - LogoutUserError, GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, @@ -64,7 +61,6 @@ import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, - UpdateUserError, DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, @@ -663,10 +659,10 @@ export function useDeleteOrder(orderId: DeleteOrderPathParams['orderId'], option }) } -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never @@ -700,14 +696,10 @@ export function useCreateUser(options: { }) } -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never @@ -800,10 +792,10 @@ export function useLoginUser +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never @@ -912,10 +904,10 @@ export function useGetUserByName +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/simple-single/src/gen/index.ts b/examples/simple-single/src/gen/index.ts index c50c88017..35e0bab3c 100644 --- a/examples/simple-single/src/gen/index.ts +++ b/examples/simple-single/src/gen/index.ts @@ -1,2 +1,3 @@ export * from './hooks' export * from './models' +export * from './zod' diff --git a/examples/simple-single/src/gen/models.ts b/examples/simple-single/src/gen/models.ts index feeb262a5..da6366415 100644 --- a/examples/simple-single/src/gen/models.ts +++ b/examples/simple-single/src/gen/models.ts @@ -587,11 +587,6 @@ export type DeleteOrderMutation = { export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -599,14 +594,8 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -616,7 +605,6 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } /** @@ -647,15 +635,9 @@ export type LoginUserQuery = { Errors: LoginUser400 } -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } /** @@ -686,11 +668,6 @@ export type GetUserByNameQuery = { Errors: GetUserByName400 | GetUserByName404 } -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -709,7 +686,6 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } /** diff --git a/examples/simple-single/src/gen/zod.ts b/examples/simple-single/src/gen/zod.ts new file mode 100644 index 000000000..a5eb44ee0 --- /dev/null +++ b/examples/simple-single/src/gen/zod.ts @@ -0,0 +1,282 @@ +import { z } from 'zod' + +export const addressSchema = z.object({ + 'street': z.string().optional(), + 'city': z.string().optional(), + 'state': z.string().optional(), + 'zip': z.string().optional(), +}) +export const apiResponseSchema = z.object({ 'code': z.number().optional(), 'type': z.string().optional(), 'message': z.string().optional() }) +export const categorySchema = z.object({ 'id': z.number().optional(), 'name': z.string().optional() }) +export const orderSchema = z.object({ + 'id': z.number().optional(), + 'petId': z.number().optional(), + 'quantity': z.number().optional(), + 'shipDate': z.string().datetime().optional(), + 'status': z.enum([`placed`, `approved`, `delivered`]).describe(`Order Status`).optional(), + 'http_status': z.union([z.literal(200), z.literal(400), z.literal(500)]).describe(`HTTP Status`).optional(), + 'complete': z.boolean().optional(), +}) +export const petNotFoundSchema = z.object({ 'code': z.number().optional(), 'message': z.string().optional() }) +export const tagSchema = z.object({ 'id': z.number().optional(), 'name': z.string().optional() }) +export const userSchema = z.object({ + 'id': z.number().optional(), + 'username': z.string().optional(), + 'firstName': z.string().optional(), + 'lastName': z.string().optional(), + 'email': z.string().email().optional(), + 'password': z.string().optional(), + 'phone': z.string().optional(), + 'userStatus': z.number().describe(`User Status`).optional(), +}) +export const customerSchema = z.object({ + 'id': z.number().optional(), + 'username': z.string().optional(), + 'address': z.array(z.lazy(() => addressSchema)).optional(), +}) +export const userArraySchema = z.array(z.lazy(() => userSchema)) +export const addPetRequestSchema = z.object({ + 'id': z.number().optional(), + 'name': z.string(), + 'category': z.lazy(() => categorySchema).optional(), + 'photoUrls': z.array(z.string()), + 'tags': z.array(z.lazy(() => tagSchema)).optional(), + 'status': z.enum([`available`, `pending`, `sold`]).describe(`pet status in the store`).optional(), +}) +export const petSchema = z.object({ + 'id': z.number().optional(), + 'name': z.string(), + 'category': z.lazy(() => categorySchema).optional(), + 'photoUrls': z.array(z.string()), + 'tags': z.array(z.lazy(() => tagSchema)).optional(), + 'status': z.enum([`available`, `pending`, `sold`]).describe(`pet status in the store`).optional(), +}) +/** + * @description Invalid ID supplied + */ +export const updatePet400Schema = z.any() + +/** + * @description Pet not found + */ +export const updatePet404Schema = z.any() + +/** + * @description Validation exception + */ +export const updatePet405Schema = z.any() + +/** + * @description Update an existent pet in the store + */ +export const updatePetMutationRequestSchema = z.lazy(() => petSchema) + +/** + * @description Successful operation + */ +export const updatePetMutationResponseSchema = z.lazy(() => petSchema) + +export const addPet405Schema = z.object({ 'code': z.number().optional(), 'message': z.string().optional() }) + +/** + * @description Create a new pet in the store + */ +export const addPetMutationRequestSchema = z.lazy(() => addPetRequestSchema) + +/** + * @description Successful operation + */ +export const addPetMutationResponseSchema = z.lazy(() => petSchema) + +/** + * @description Invalid status value + */ +export const findPetsByStatus400Schema = z.any() +export const findPetsByStatusQueryParamsSchema = z.object({ + 'status': z.enum([`available`, `pending`, `sold`]).default('available').describe(`Status values that need to be considered for filter`).optional(), +}).optional() + +/** + * @description successful operation + */ +export const findPetsByStatusQueryResponseSchema = z.array(z.lazy(() => petSchema)) + +/** + * @description Invalid tag value + */ +export const findPetsByTags400Schema = z.any() +export const findPetsByTagsQueryParamsSchema = z.object({ + 'tags': z.array(z.string()).describe(`Tags to filter by`).optional(), + 'page': z.string().describe(`to request with required page number or pagination`).optional(), + 'pageSize': z.string().describe(`to request with required page size`).optional(), +}).optional() + +/** + * @description successful operation + */ +export const findPetsByTagsQueryResponseSchema = z.array(z.lazy(() => petSchema)) + +/** + * @description Invalid ID supplied + */ +export const getPetById400Schema = z.any() + +/** + * @description Pet not found + */ +export const getPetById404Schema = z.any() +export const getPetByIdPathParamsSchema = z.object({ 'petId': z.number().describe(`ID of pet to return`) }) + +/** + * @description successful operation + */ +export const getPetByIdQueryResponseSchema = z.lazy(() => petSchema) + +/** + * @description Invalid input + */ +export const updatePetWithForm405Schema = z.any() +export const updatePetWithFormMutationResponseSchema = z.any() +export const updatePetWithFormPathParamsSchema = z.object({ 'petId': z.number().describe(`ID of pet that needs to be updated`) }) +export const updatePetWithFormQueryParamsSchema = z.object({ + 'name': z.string().describe(`Name of pet that needs to be updated`).optional(), + 'status': z.string().describe(`Status of pet that needs to be updated`).optional(), +}).optional() + +/** + * @description Invalid pet value + */ +export const deletePet400Schema = z.any() +export const deletePetHeaderParamsSchema = z.object({ 'api_key': z.string().optional() }).optional() +export const deletePetMutationResponseSchema = z.any() +export const deletePetPathParamsSchema = z.object({ 'petId': z.number().describe(`Pet id to delete`) }) + +export const uploadFileMutationRequestSchema = z.string() +export const uploadFilePathParamsSchema = z.object({ 'petId': z.number().describe(`ID of pet to update`) }) +export const uploadFileQueryParamsSchema = z.object({ 'additionalMetadata': z.string().describe(`Additional Metadata`).optional() }).optional() + +/** + * @description successful operation + */ +export const uploadFileMutationResponseSchema = z.lazy(() => apiResponseSchema) + +/** + * @description successful operation + */ +export const getInventoryQueryResponseSchema = z.object({}).catchall(z.number()) + +/** + * @description Invalid input + */ +export const placeOrder405Schema = z.any() +export const placeOrderMutationRequestSchema = z.lazy(() => orderSchema) + +/** + * @description successful operation + */ +export const placeOrderMutationResponseSchema = z.lazy(() => orderSchema) + +/** + * @description Invalid input + */ +export const placeOrderPatch405Schema = z.any() +export const placeOrderPatchMutationRequestSchema = z.lazy(() => orderSchema) + +/** + * @description successful operation + */ +export const placeOrderPatchMutationResponseSchema = z.lazy(() => orderSchema) + +/** + * @description Invalid ID supplied + */ +export const getOrderById400Schema = z.any() + +/** + * @description Order not found + */ +export const getOrderById404Schema = z.any() +export const getOrderByIdPathParamsSchema = z.object({ 'orderId': z.number().describe(`ID of order that needs to be fetched`) }) + +/** + * @description successful operation + */ +export const getOrderByIdQueryResponseSchema = z.lazy(() => orderSchema) + +/** + * @description Invalid ID supplied + */ +export const deleteOrder400Schema = z.any() + +/** + * @description Order not found + */ +export const deleteOrder404Schema = z.any() +export const deleteOrderMutationResponseSchema = z.any() +export const deleteOrderPathParamsSchema = z.object({ 'orderId': z.number().describe(`ID of the order that needs to be deleted`) }) + +export const createUserMutationResponseSchema = z.any() + +/** + * @description Created user object + */ +export const createUserMutationRequestSchema = z.lazy(() => userSchema) + +export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema)) + +/** + * @description Successful operation + */ +export const createUsersWithListInputMutationResponseSchema = z.lazy(() => userSchema) + +/** + * @description Invalid username/password supplied + */ +export const loginUser400Schema = z.any() +export const loginUserQueryParamsSchema = z.object({ + 'username': z.string().describe(`The user name for login`).optional(), + 'password': z.string().describe(`The password for login in clear text`).optional(), +}).optional() + +/** + * @description successful operation + */ +export const loginUserQueryResponseSchema = z.string() + +export const logoutUserQueryResponseSchema = z.any() + +/** + * @description Invalid username supplied + */ +export const getUserByName400Schema = z.any() + +/** + * @description User not found + */ +export const getUserByName404Schema = z.any() +export const getUserByNamePathParamsSchema = z.object({ 'username': z.string().describe(`The name that needs to be fetched. Use user1 for testing. `) }) + +/** + * @description successful operation + */ +export const getUserByNameQueryResponseSchema = z.lazy(() => userSchema) + +export const updateUserMutationResponseSchema = z.any() +export const updateUserPathParamsSchema = z.object({ 'username': z.string().describe(`name that need to be deleted`) }) + +/** + * @description Update an existent user in the store + */ +export const updateUserMutationRequestSchema = z.lazy(() => userSchema) + +/** + * @description Invalid username supplied + */ +export const deleteUser400Schema = z.any() + +/** + * @description User not found + */ +export const deleteUser404Schema = z.any() +export const deleteUserMutationResponseSchema = z.any() +export const deleteUserPathParamsSchema = z.object({ 'username': z.string().describe(`The name that needs to be deleted`) }) diff --git a/examples/solid-query/package.json b/examples/solid-query/package.json index 9e8624da1..cfd4ef961 100644 --- a/examples/solid-query/package.json +++ b/examples/solid-query/package.json @@ -29,8 +29,8 @@ "@kubb/swagger-zod": "workspace:*", "@tanstack/solid-query": "^4.36.1", "axios": "^1.6.7", - "solid-js": "^1.8.12", - "tsup": "^8.0.1" + "solid-js": "^1.8.15", + "tsup": "^8.0.2" }, "devDependencies": { "typescript": "^5.3.3" diff --git a/examples/solid-query/src/gen/hooks/createUserQuery.ts b/examples/solid-query/src/gen/hooks/createUserQuery.ts index 464b2e8a8..a23e4b349 100644 --- a/examples/solid-query/src/gen/hooks/createUserQuery.ts +++ b/examples/solid-query/src/gen/hooks/createUserQuery.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { createMutation } from '@tanstack/solid-query' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' import type { CreateMutationOptions, CreateMutationResult } from '@tanstack/solid-query' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/solid-query/src/gen/hooks/createUsersWithListInputQuery.ts b/examples/solid-query/src/gen/hooks/createUsersWithListInputQuery.ts index a5a5ce534..b67002f62 100644 --- a/examples/solid-query/src/gen/hooks/createUsersWithListInputQuery.ts +++ b/examples/solid-query/src/gen/hooks/createUsersWithListInputQuery.ts @@ -1,20 +1,12 @@ import client from '@kubb/swagger-client/client' import { createMutation } from '@tanstack/solid-query' -import type { - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, -} from '../models/CreateUsersWithListInput' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' import type { CreateMutationOptions, CreateMutationResult } from '@tanstack/solid-query' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/solid-query/src/gen/hooks/logoutUserQuery.ts b/examples/solid-query/src/gen/hooks/logoutUserQuery.ts index ce30844be..4dcab036f 100644 --- a/examples/solid-query/src/gen/hooks/logoutUserQuery.ts +++ b/examples/solid-query/src/gen/hooks/logoutUserQuery.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { createQuery } from '@tanstack/solid-query' -import type { LogoutUserQueryResponse, LogoutUserError } from '../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../models/LogoutUser' import type { CreateBaseQueryOptions, CreateQueryResult, QueryKey, WithRequired } from '@tanstack/solid-query' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never diff --git a/examples/solid-query/src/gen/hooks/updateUserQuery.ts b/examples/solid-query/src/gen/hooks/updateUserQuery.ts index 17305e158..6f0d6b894 100644 --- a/examples/solid-query/src/gen/hooks/updateUserQuery.ts +++ b/examples/solid-query/src/gen/hooks/updateUserQuery.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { createMutation } from '@tanstack/solid-query' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' import type { CreateMutationOptions, CreateMutationResult } from '@tanstack/solid-query' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/solid-query/src/gen/models/CreateUser.ts b/examples/solid-query/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/solid-query/src/gen/models/CreateUser.ts +++ b/examples/solid-query/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/solid-query/src/gen/models/CreateUsersWithListInput.ts b/examples/solid-query/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/solid-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/solid-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/solid-query/src/gen/models/LogoutUser.ts b/examples/solid-query/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/solid-query/src/gen/models/LogoutUser.ts +++ b/examples/solid-query/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/solid-query/src/gen/models/UpdateUser.ts b/examples/solid-query/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/solid-query/src/gen/models/UpdateUser.ts +++ b/examples/solid-query/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/svelte-query/package.json b/examples/svelte-query/package.json index 12d2433ff..1bd424a3e 100644 --- a/examples/svelte-query/package.json +++ b/examples/svelte-query/package.json @@ -30,7 +30,7 @@ "@tanstack/svelte-query": "^4.36.1", "axios": "^1.6.7", "svelte": "^3.59.2", - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "devDependencies": { "typescript": "^5.3.3" diff --git a/examples/svelte-query/src/gen/hooks/createUserQuery.ts b/examples/svelte-query/src/gen/hooks/createUserQuery.ts index 6d1cafc00..4fdc9f0f7 100644 --- a/examples/svelte-query/src/gen/hooks/createUserQuery.ts +++ b/examples/svelte-query/src/gen/hooks/createUserQuery.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { createMutation } from '@tanstack/svelte-query' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' import type { CreateMutationOptions, CreateMutationResult } from '@tanstack/svelte-query' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/svelte-query/src/gen/hooks/createUsersWithListInputQuery.ts b/examples/svelte-query/src/gen/hooks/createUsersWithListInputQuery.ts index 5c57e3a23..2e84a2db7 100644 --- a/examples/svelte-query/src/gen/hooks/createUsersWithListInputQuery.ts +++ b/examples/svelte-query/src/gen/hooks/createUsersWithListInputQuery.ts @@ -1,20 +1,12 @@ import client from '@kubb/swagger-client/client' import { createMutation } from '@tanstack/svelte-query' -import type { - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, -} from '../models/CreateUsersWithListInput' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' import type { CreateMutationOptions, CreateMutationResult } from '@tanstack/svelte-query' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/svelte-query/src/gen/hooks/logoutUserQuery.ts b/examples/svelte-query/src/gen/hooks/logoutUserQuery.ts index b736a2bb9..7b351d8bf 100644 --- a/examples/svelte-query/src/gen/hooks/logoutUserQuery.ts +++ b/examples/svelte-query/src/gen/hooks/logoutUserQuery.ts @@ -1,6 +1,6 @@ import client from '@kubb/swagger-client/client' import { createQuery, createInfiniteQuery } from '@tanstack/svelte-query' -import type { LogoutUserQueryResponse, LogoutUserError } from '../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../models/LogoutUser' import type { CreateBaseQueryOptions, CreateQueryResult, @@ -11,10 +11,10 @@ import type { InfiniteData, } from '@tanstack/svelte-query' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never diff --git a/examples/svelte-query/src/gen/hooks/updateUserQuery.ts b/examples/svelte-query/src/gen/hooks/updateUserQuery.ts index 228b3b509..aa557e812 100644 --- a/examples/svelte-query/src/gen/hooks/updateUserQuery.ts +++ b/examples/svelte-query/src/gen/hooks/updateUserQuery.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { createMutation } from '@tanstack/svelte-query' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' import type { CreateMutationOptions, CreateMutationResult } from '@tanstack/svelte-query' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/svelte-query/src/gen/models/CreateUser.ts b/examples/svelte-query/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/svelte-query/src/gen/models/CreateUser.ts +++ b/examples/svelte-query/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/svelte-query/src/gen/models/CreateUsersWithListInput.ts b/examples/svelte-query/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/svelte-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/svelte-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/svelte-query/src/gen/models/LogoutUser.ts b/examples/svelte-query/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/svelte-query/src/gen/models/LogoutUser.ts +++ b/examples/svelte-query/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/svelte-query/src/gen/models/UpdateUser.ts b/examples/svelte-query/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/svelte-query/src/gen/models/UpdateUser.ts +++ b/examples/svelte-query/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/swr/package.json b/examples/swr/package.json index 0385935fe..4df40d9e8 100644 --- a/examples/swr/package.json +++ b/examples/swr/package.json @@ -29,7 +29,7 @@ "@kubb/swagger-zod": "workspace:*", "axios": "^1.6.7", "react": "^18.2.0", - "swr": "^2.2.4", - "tsup": "^8.0.1" + "swr": "^2.2.5", + "tsup": "^8.0.2" } } diff --git a/examples/swr/src/gen/hooks/useCreateUser.ts b/examples/swr/src/gen/hooks/useCreateUser.ts index 536c9742c..b654293c2 100644 --- a/examples/swr/src/gen/hooks/useCreateUser.ts +++ b/examples/swr/src/gen/hooks/useCreateUser.ts @@ -1,12 +1,12 @@ import useSWRMutation from 'swr/mutation' import client from '@kubb/swagger-client/client' import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts index 3e463fde9..01085dece 100644 --- a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts @@ -1,20 +1,12 @@ import useSWRMutation from 'swr/mutation' import client from '@kubb/swagger-client/client' import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation' -import type { - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, -} from '../models/CreateUsersWithListInput' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/swr/src/gen/hooks/useLogoutUser.ts b/examples/swr/src/gen/hooks/useLogoutUser.ts index 773f94c84..20dd126af 100644 --- a/examples/swr/src/gen/hooks/useLogoutUser.ts +++ b/examples/swr/src/gen/hooks/useLogoutUser.ts @@ -1,12 +1,12 @@ import useSWR from 'swr' import client from '@kubb/swagger-client/client' import type { SWRConfiguration, SWRResponse } from 'swr' -import type { LogoutUserQueryResponse, LogoutUserError } from '../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../models/LogoutUser' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never diff --git a/examples/swr/src/gen/hooks/useUpdateUser.ts b/examples/swr/src/gen/hooks/useUpdateUser.ts index ffe5e9329..0e591cf4d 100644 --- a/examples/swr/src/gen/hooks/useUpdateUser.ts +++ b/examples/swr/src/gen/hooks/useUpdateUser.ts @@ -1,12 +1,12 @@ import useSWRMutation from 'swr/mutation' import client from '@kubb/swagger-client/client' import type { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/swr/src/gen/models/CreateUser.ts b/examples/swr/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/swr/src/gen/models/CreateUser.ts +++ b/examples/swr/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/swr/src/gen/models/CreateUsersWithListInput.ts b/examples/swr/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/swr/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/swr/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/swr/src/gen/models/LogoutUser.ts b/examples/swr/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/swr/src/gen/models/LogoutUser.ts +++ b/examples/swr/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/swr/src/gen/models/UpdateUser.ts b/examples/swr/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/swr/src/gen/models/UpdateUser.ts +++ b/examples/swr/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/typescript/package.json b/examples/typescript/package.json index 51e80002a..e5c9ecd79 100644 --- a/examples/typescript/package.json +++ b/examples/typescript/package.json @@ -25,7 +25,7 @@ "@kubb/swagger": "workspace:*", "@kubb/swagger-ts": "workspace:*", "axios": "^1.6.7", - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "devDependencies": { "typescript": "^5.3.3" diff --git a/examples/typescript/src/gen/index.ts b/examples/typescript/src/gen/index.ts index cb44a60ba..767994749 100644 --- a/examples/typescript/src/gen/index.ts +++ b/examples/typescript/src/gen/index.ts @@ -13,11 +13,9 @@ export type { Address, ApiResponse, Category, - CreateUserError, CreateUserMutation, CreateUserMutationRequest, CreateUserMutationResponse, - CreateUsersWithListInputError, CreateUsersWithListInputMutation, CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, @@ -67,7 +65,6 @@ export type { LoginUserQuery, LoginUserQueryParams, LoginUserQueryResponse, - LogoutUserError, LogoutUserQuery, LogoutUserQueryResponse, Oas, @@ -97,7 +94,6 @@ export type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, - UpdateUserError, UpdateUserMutation, UpdateUserMutationRequest, UpdateUserMutationResponse, diff --git a/examples/typescript/src/gen/models.ts b/examples/typescript/src/gen/models.ts index c8b9030cb..477d63d3b 100644 --- a/examples/typescript/src/gen/models.ts +++ b/examples/typescript/src/gen/models.ts @@ -592,11 +592,6 @@ export type DeleteOrderMutation = { export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -604,14 +599,8 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -621,7 +610,6 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } /** @@ -654,15 +642,9 @@ export type LoginUserQuery = { Errors: LoginUser400 } -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } /** @@ -693,11 +675,6 @@ export type GetUserByNameQuery = { Errors: GetUserByName400 | GetUserByName404 } -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -716,7 +693,6 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } /** diff --git a/examples/typescript/src/gen/modelsConst.ts b/examples/typescript/src/gen/modelsConst.ts index ce0cb6c57..78a2fa300 100644 --- a/examples/typescript/src/gen/modelsConst.ts +++ b/examples/typescript/src/gen/modelsConst.ts @@ -597,11 +597,6 @@ export type DeleteOrderMutation = { export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -609,14 +604,8 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -626,7 +615,6 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } /** @@ -659,15 +647,9 @@ export type LoginUserQuery = { Errors: LoginUser400 } -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } /** @@ -698,11 +680,6 @@ export type GetUserByNameQuery = { Errors: GetUserByName400 | GetUserByName404 } -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -721,7 +698,6 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } /** diff --git a/examples/typescript/src/gen/modelsConstEnum.ts b/examples/typescript/src/gen/modelsConstEnum.ts index 8035f8399..e4499d805 100644 --- a/examples/typescript/src/gen/modelsConstEnum.ts +++ b/examples/typescript/src/gen/modelsConstEnum.ts @@ -592,11 +592,6 @@ export type DeleteOrderMutation = { export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -604,14 +599,8 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -621,7 +610,6 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } /** @@ -654,15 +642,9 @@ export type LoginUserQuery = { Errors: LoginUser400 } -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } /** @@ -693,11 +675,6 @@ export type GetUserByNameQuery = { Errors: GetUserByName400 | GetUserByName404 } -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -716,7 +693,6 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } /** diff --git a/examples/typescript/src/gen/modelsLiteral.ts b/examples/typescript/src/gen/modelsLiteral.ts index b89a6614f..cde58415a 100644 --- a/examples/typescript/src/gen/modelsLiteral.ts +++ b/examples/typescript/src/gen/modelsLiteral.ts @@ -572,11 +572,6 @@ export type DeleteOrderMutation = { export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -584,14 +579,8 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -601,7 +590,6 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } /** @@ -634,15 +622,9 @@ export type LoginUserQuery = { Errors: LoginUser400 } -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } /** @@ -673,11 +655,6 @@ export type GetUserByNameQuery = { Errors: GetUserByName400 | GetUserByName404 } -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -696,7 +673,6 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } /** diff --git a/examples/typescript/src/gen/modelsPascalConst.ts b/examples/typescript/src/gen/modelsPascalConst.ts index 9ddf9f698..d8209e3c6 100644 --- a/examples/typescript/src/gen/modelsPascalConst.ts +++ b/examples/typescript/src/gen/modelsPascalConst.ts @@ -597,11 +597,6 @@ export type DeleteOrderMutation = { export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -609,14 +604,8 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -626,7 +615,6 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } /** @@ -659,15 +647,9 @@ export type LoginUserQuery = { Errors: LoginUser400 } -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } /** @@ -698,11 +680,6 @@ export type GetUserByNameQuery = { Errors: GetUserByName400 | GetUserByName404 } -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -721,7 +698,6 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } /** diff --git a/examples/typescript/src/gen/ts/models/CreateUser.ts b/examples/typescript/src/gen/ts/models/CreateUser.ts index 9f964275e..08a426fd1 100644 --- a/examples/typescript/src/gen/ts/models/CreateUser.ts +++ b/examples/typescript/src/gen/ts/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from '../../models' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/typescript/src/gen/ts/models/CreateUsersWithListInput.ts b/examples/typescript/src/gen/ts/models/CreateUsersWithListInput.ts index f00db570f..6012786ab 100644 --- a/examples/typescript/src/gen/ts/models/CreateUsersWithListInput.ts +++ b/examples/typescript/src/gen/ts/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from '../../models' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/typescript/src/gen/ts/models/LogoutUser.ts b/examples/typescript/src/gen/ts/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/typescript/src/gen/ts/models/LogoutUser.ts +++ b/examples/typescript/src/gen/ts/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/typescript/src/gen/ts/models/UpdateUser.ts b/examples/typescript/src/gen/ts/models/UpdateUser.ts index 7eb0ccd5d..886fdebe1 100644 --- a/examples/typescript/src/gen/ts/models/UpdateUser.ts +++ b/examples/typescript/src/gen/ts/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from '../../models' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/typescript/src/gen/ts/models/index.ts b/examples/typescript/src/gen/ts/models/index.ts index 9995ef61c..0d8dd64c4 100644 --- a/examples/typescript/src/gen/ts/models/index.ts +++ b/examples/typescript/src/gen/ts/models/index.ts @@ -4,9 +4,8 @@ export { addPetRequestStatus } from './AddPetRequest' export type { Address } from './Address' export type { ApiResponse } from './ApiResponse' export type { Category } from './Category' -export type { CreateUserError, CreateUserMutation, CreateUserMutationRequest, CreateUserMutationResponse } from './CreateUser' +export type { CreateUserMutation, CreateUserMutationRequest, CreateUserMutationResponse } from './CreateUser' export type { - CreateUsersWithListInputError, CreateUsersWithListInputMutation, CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, @@ -29,7 +28,7 @@ export type { GetOrderById400, GetOrderById404, GetOrderByIdPathParams, GetOrder export type { GetPetById400, GetPetById404, GetPetByIdPathParams, GetPetByIdQuery, GetPetByIdQueryResponse } from './GetPetById' export type { GetUserByName400, GetUserByName404, GetUserByNamePathParams, GetUserByNameQuery, GetUserByNameQueryResponse } from './GetUserByName' export type { LoginUser400, LoginUserQuery, LoginUserQueryParams, LoginUserQueryResponse } from './LoginUser' -export type { LogoutUserError, LogoutUserQuery, LogoutUserQueryResponse } from './LogoutUser' +export type { LogoutUserQuery, LogoutUserQueryResponse } from './LogoutUser' export type { Oas } from './oas' export { oas } from './oas' export type { Order, OrderHttpStatus, OrderStatus } from './Order' @@ -48,7 +47,7 @@ export type { UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, } from './UpdatePetWithForm' -export type { UpdateUserError, UpdateUserMutation, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from './UpdateUser' +export type { UpdateUserMutation, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from './UpdateUser' export type { UploadFileMutation, UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from './UploadFile' export type { User } from './User' export type { UserArray } from './UserArray' diff --git a/examples/vue-query-v5/package.json b/examples/vue-query-v5/package.json index b19282032..ceade2aa7 100644 --- a/examples/vue-query-v5/package.json +++ b/examples/vue-query-v5/package.json @@ -29,14 +29,14 @@ "@kubb/swagger-tanstack-query": "workspace:*", "@kubb/swagger-ts": "workspace:*", "@kubb/swagger-zod": "workspace:*", - "@tanstack/vue-query": "^5.18.1", + "@tanstack/vue-query": "^5.21.7", "axios": "^1.6.7", - "vue": "^3.4.15" + "vue": "^3.4.19" }, "devDependencies": { "@vitejs/plugin-vue": "^4.6.2", "msw": "^1.3.2", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "~5.2.2", "vite": "^4.5.2" }, diff --git a/examples/vue-query-v5/src/gen/hooks/useCreateUser.ts b/examples/vue-query-v5/src/gen/hooks/useCreateUser.ts index f9ca3dc77..b30bd4cbd 100644 --- a/examples/vue-query-v5/src/gen/hooks/useCreateUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useCreateUser.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/vue-query' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' import type { UseMutationOptions } from '@tanstack/vue-query' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/vue-query-v5/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/vue-query-v5/src/gen/hooks/useCreateUsersWithListInput.ts index bc85288bf..ece17df10 100644 --- a/examples/vue-query-v5/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/vue-query-v5/src/gen/hooks/useCreateUsersWithListInput.ts @@ -1,20 +1,12 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/vue-query' -import type { - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, -} from '../models/CreateUsersWithListInput' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' import type { UseMutationOptions } from '@tanstack/vue-query' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/vue-query-v5/src/gen/hooks/useFindPetsByStatus.ts b/examples/vue-query-v5/src/gen/hooks/useFindPetsByStatus.ts index 27977090a..ea8232ab6 100644 --- a/examples/vue-query-v5/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/vue-query-v5/src/gen/hooks/useFindPetsByStatus.ts @@ -60,7 +60,7 @@ export function useFindPetsByStatus< const query = useQuery({ ...(findPetsByStatusQueryOptions(refParams, clientOptions) as QueryObserverOptions), queryKey, - ...(queryOptions as unknown as QueryObserverOptions), + ...(queryOptions as unknown as Omit), }) as UseQueryReturnType & { queryKey: TQueryKey } diff --git a/examples/vue-query-v5/src/gen/hooks/useFindPetsByTags.ts b/examples/vue-query-v5/src/gen/hooks/useFindPetsByTags.ts index cd2ed00f6..8437d7da6 100644 --- a/examples/vue-query-v5/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/vue-query-v5/src/gen/hooks/useFindPetsByTags.ts @@ -59,7 +59,7 @@ export function useFindPetsByTags< const query = useQuery({ ...(findPetsByTagsQueryOptions(refParams, clientOptions) as QueryObserverOptions), queryKey, - ...(queryOptions as unknown as QueryObserverOptions), + ...(queryOptions as unknown as Omit), }) as UseQueryReturnType & { queryKey: TQueryKey } diff --git a/examples/vue-query-v5/src/gen/hooks/useGetInventory.ts b/examples/vue-query-v5/src/gen/hooks/useGetInventory.ts index 5bcc03a75..3a82c1fbe 100644 --- a/examples/vue-query-v5/src/gen/hooks/useGetInventory.ts +++ b/examples/vue-query-v5/src/gen/hooks/useGetInventory.ts @@ -50,7 +50,7 @@ export function useGetInventory), }) as UseQueryReturnType & { queryKey: TQueryKey } diff --git a/examples/vue-query-v5/src/gen/hooks/useGetOrderById.ts b/examples/vue-query-v5/src/gen/hooks/useGetOrderById.ts index b39d6a6e0..8903aaa8e 100644 --- a/examples/vue-query-v5/src/gen/hooks/useGetOrderById.ts +++ b/examples/vue-query-v5/src/gen/hooks/useGetOrderById.ts @@ -55,7 +55,7 @@ export function useGetOrderById), }) as UseQueryReturnType & { queryKey: TQueryKey } diff --git a/examples/vue-query-v5/src/gen/hooks/useGetPetById.ts b/examples/vue-query-v5/src/gen/hooks/useGetPetById.ts index f72bf3c58..5f94119e9 100644 --- a/examples/vue-query-v5/src/gen/hooks/useGetPetById.ts +++ b/examples/vue-query-v5/src/gen/hooks/useGetPetById.ts @@ -54,7 +54,7 @@ export function useGetPetById), }) as UseQueryReturnType & { queryKey: TQueryKey } diff --git a/examples/vue-query-v5/src/gen/hooks/useGetUserByName.ts b/examples/vue-query-v5/src/gen/hooks/useGetUserByName.ts index 058c0e7f6..0db18da9a 100644 --- a/examples/vue-query-v5/src/gen/hooks/useGetUserByName.ts +++ b/examples/vue-query-v5/src/gen/hooks/useGetUserByName.ts @@ -54,7 +54,7 @@ export function useGetUserByName), }) as UseQueryReturnType & { queryKey: TQueryKey } diff --git a/examples/vue-query-v5/src/gen/hooks/useLoginUser.ts b/examples/vue-query-v5/src/gen/hooks/useLoginUser.ts index 39f61cbda..78e65cf57 100644 --- a/examples/vue-query-v5/src/gen/hooks/useLoginUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useLoginUser.ts @@ -54,7 +54,7 @@ export function useLoginUser), }) as UseQueryReturnType & { queryKey: TQueryKey } diff --git a/examples/vue-query-v5/src/gen/hooks/useLogoutUser.ts b/examples/vue-query-v5/src/gen/hooks/useLogoutUser.ts index d0de1a3ee..178c6d76a 100644 --- a/examples/vue-query-v5/src/gen/hooks/useLogoutUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useLogoutUser.ts @@ -1,12 +1,12 @@ import client from '@kubb/swagger-client/client' import { useQuery, queryOptions } from '@tanstack/vue-query' -import type { LogoutUserQueryResponse, LogoutUserError } from '../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../models/LogoutUser' import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from '@tanstack/vue-query' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never @@ -49,7 +49,7 @@ export function useLogoutUser), }) as UseQueryReturnType & { queryKey: TQueryKey } diff --git a/examples/vue-query-v5/src/gen/hooks/useUpdateUser.ts b/examples/vue-query-v5/src/gen/hooks/useUpdateUser.ts index bdeece701..71e5f84c8 100644 --- a/examples/vue-query-v5/src/gen/hooks/useUpdateUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useUpdateUser.ts @@ -1,14 +1,14 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/vue-query' import { unref } from 'vue' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' import type { UseMutationOptions } from '@tanstack/vue-query' import type { MaybeRef } from 'vue' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/vue-query-v5/src/gen/models/CreateUser.ts b/examples/vue-query-v5/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/vue-query-v5/src/gen/models/CreateUser.ts +++ b/examples/vue-query-v5/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts b/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/vue-query-v5/src/gen/models/LogoutUser.ts b/examples/vue-query-v5/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/vue-query-v5/src/gen/models/LogoutUser.ts +++ b/examples/vue-query-v5/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/vue-query-v5/src/gen/models/UpdateUser.ts b/examples/vue-query-v5/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/vue-query-v5/src/gen/models/UpdateUser.ts +++ b/examples/vue-query-v5/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/vue-query/package.json b/examples/vue-query/package.json index d879063b4..e7f8762d0 100644 --- a/examples/vue-query/package.json +++ b/examples/vue-query/package.json @@ -31,12 +31,12 @@ "@kubb/swagger-zod": "workspace:*", "@tanstack/vue-query": "^4.37.1", "axios": "^1.6.7", - "vue": "^3.4.15" + "vue": "^3.4.19" }, "devDependencies": { "@vitejs/plugin-vue": "^4.6.2", "msw": "^1.3.2", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "~5.2.2", "vite": "^4.5.2" }, diff --git a/examples/vue-query/src/gen/hooks/useCreateUser.ts b/examples/vue-query/src/gen/hooks/useCreateUser.ts index 6a13abb75..c056b468a 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUser.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUser.ts @@ -1,13 +1,13 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/vue-query' -import type { CreateUserMutationRequest, CreateUserMutationResponse, CreateUserError } from '../models/CreateUser' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' import type { UseMutationReturnType } from '@tanstack/vue-query' import type { VueMutationObserverOptions } from '@tanstack/vue-query/build/lib/useMutation' -type CreateUserClient = typeof client +type CreateUserClient = typeof client type CreateUser = { data: CreateUserMutationResponse - error: CreateUserError + error: never request: CreateUserMutationRequest pathParams: never queryParams: never diff --git a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts index 529a376de..90b5b6f4c 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts @@ -1,21 +1,13 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/vue-query' -import type { - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, -} from '../models/CreateUsersWithListInput' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' import type { UseMutationReturnType } from '@tanstack/vue-query' import type { VueMutationObserverOptions } from '@tanstack/vue-query/build/lib/useMutation' -type CreateUsersWithListInputClient = typeof client< - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest -> +type CreateUsersWithListInputClient = typeof client type CreateUsersWithListInput = { data: CreateUsersWithListInputMutationResponse - error: CreateUsersWithListInputError + error: never request: CreateUsersWithListInputMutationRequest pathParams: never queryParams: never diff --git a/examples/vue-query/src/gen/hooks/useLogoutUser.ts b/examples/vue-query/src/gen/hooks/useLogoutUser.ts index edc6b0e39..f83948f9a 100644 --- a/examples/vue-query/src/gen/hooks/useLogoutUser.ts +++ b/examples/vue-query/src/gen/hooks/useLogoutUser.ts @@ -1,13 +1,13 @@ import client from '@kubb/swagger-client/client' import { useQuery } from '@tanstack/vue-query' -import type { LogoutUserQueryResponse, LogoutUserError } from '../models/LogoutUser' +import type { LogoutUserQueryResponse } from '../models/LogoutUser' import type { UseQueryReturnType, QueryKey, WithRequired } from '@tanstack/vue-query' import type { VueQueryObserverOptions } from '@tanstack/vue-query/build/lib/types' -type LogoutUserClient = typeof client +type LogoutUserClient = typeof client type LogoutUser = { data: LogoutUserQueryResponse - error: LogoutUserError + error: never request: never pathParams: never queryParams: never diff --git a/examples/vue-query/src/gen/hooks/useUpdateUser.ts b/examples/vue-query/src/gen/hooks/useUpdateUser.ts index c70959281..510c543bc 100644 --- a/examples/vue-query/src/gen/hooks/useUpdateUser.ts +++ b/examples/vue-query/src/gen/hooks/useUpdateUser.ts @@ -1,15 +1,15 @@ import client from '@kubb/swagger-client/client' import { useMutation } from '@tanstack/vue-query' import { unref } from 'vue' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams, UpdateUserError } from '../models/UpdateUser' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' import type { UseMutationReturnType } from '@tanstack/vue-query' import type { VueMutationObserverOptions } from '@tanstack/vue-query/build/lib/useMutation' import type { MaybeRef } from 'vue' -type UpdateUserClient = typeof client +type UpdateUserClient = typeof client type UpdateUser = { data: UpdateUserMutationResponse - error: UpdateUserError + error: never request: UpdateUserMutationRequest pathParams: UpdateUserPathParams queryParams: never diff --git a/examples/vue-query/src/gen/models/CreateUser.ts b/examples/vue-query/src/gen/models/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/vue-query/src/gen/models/CreateUser.ts +++ b/examples/vue-query/src/gen/models/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/vue-query/src/gen/models/LogoutUser.ts b/examples/vue-query/src/gen/models/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/vue-query/src/gen/models/LogoutUser.ts +++ b/examples/vue-query/src/gen/models/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/vue-query/src/gen/models/UpdateUser.ts b/examples/vue-query/src/gen/models/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/vue-query/src/gen/models/UpdateUser.ts +++ b/examples/vue-query/src/gen/models/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/zod/package.json b/examples/zod/package.json index 2f939ba53..a6c6200f2 100644 --- a/examples/zod/package.json +++ b/examples/zod/package.json @@ -27,7 +27,7 @@ "@kubb/swagger-ts": "workspace:*", "@kubb/swagger-zod": "workspace:*", "react": "^18.2.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "zod": "^3.22.4" }, "devDependencies": { diff --git a/examples/zod/src/gen/ts/CreateUser.ts b/examples/zod/src/gen/ts/CreateUser.ts index 0ed9afc2a..1e4b4273a 100644 --- a/examples/zod/src/gen/ts/CreateUser.ts +++ b/examples/zod/src/gen/ts/CreateUser.ts @@ -2,11 +2,6 @@ import type { User } from './User' export type CreateUserMutationResponse = any | null -/** - * @description successful operation - */ -export type CreateUserError = User - /** * @description Created user object */ @@ -14,5 +9,4 @@ export type CreateUserMutationRequest = User export type CreateUserMutation = { Response: CreateUserMutationResponse Request: CreateUserMutationRequest - Errors: CreateUserError } diff --git a/examples/zod/src/gen/ts/CreateUsersWithListInput.ts b/examples/zod/src/gen/ts/CreateUsersWithListInput.ts index b0ee877b2..cceaad8e3 100644 --- a/examples/zod/src/gen/ts/CreateUsersWithListInput.ts +++ b/examples/zod/src/gen/ts/CreateUsersWithListInput.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type CreateUsersWithListInputError = any | null - export type CreateUsersWithListInputMutationRequest = User[] /** @@ -14,5 +9,4 @@ export type CreateUsersWithListInputMutationResponse = User export type CreateUsersWithListInputMutation = { Response: CreateUsersWithListInputMutationResponse Request: CreateUsersWithListInputMutationRequest - Errors: CreateUsersWithListInputError } diff --git a/examples/zod/src/gen/ts/LogoutUser.ts b/examples/zod/src/gen/ts/LogoutUser.ts index bb19c4c00..bdc222518 100644 --- a/examples/zod/src/gen/ts/LogoutUser.ts +++ b/examples/zod/src/gen/ts/LogoutUser.ts @@ -1,10 +1,4 @@ -/** - * @description successful operation - */ -export type LogoutUserError = any | null - export type LogoutUserQueryResponse = any | null export type LogoutUserQuery = { Response: LogoutUserQueryResponse - Errors: LogoutUserError } diff --git a/examples/zod/src/gen/ts/UpdateUser.ts b/examples/zod/src/gen/ts/UpdateUser.ts index 7c043f70e..745a23d83 100644 --- a/examples/zod/src/gen/ts/UpdateUser.ts +++ b/examples/zod/src/gen/ts/UpdateUser.ts @@ -1,10 +1,5 @@ import type { User } from './User' -/** - * @description successful operation - */ -export type UpdateUserError = any | null - export type UpdateUserMutationResponse = any | null export type UpdateUserPathParams = { @@ -23,5 +18,4 @@ export type UpdateUserMutation = { Response: UpdateUserMutationResponse Request: UpdateUserMutationRequest PathParams: UpdateUserPathParams - Errors: UpdateUserError } diff --git a/examples/zod/src/gen/zod/createUserSchema.ts b/examples/zod/src/gen/zod/createUserSchema.ts index 59f494825..e956f68b4 100644 --- a/examples/zod/src/gen/zod/createUserSchema.ts +++ b/examples/zod/src/gen/zod/createUserSchema.ts @@ -3,11 +3,6 @@ import { userSchema } from './userSchema' export const createUserMutationResponseSchema = z.any() -/** - * @description successful operation - */ -export const createUserErrorSchema = z.lazy(() => userSchema) - /** * @description Created user object */ diff --git a/examples/zod/src/gen/zod/createUsersWithListInputSchema.ts b/examples/zod/src/gen/zod/createUsersWithListInputSchema.ts index 8ca7dd89e..eaac93fed 100644 --- a/examples/zod/src/gen/zod/createUsersWithListInputSchema.ts +++ b/examples/zod/src/gen/zod/createUsersWithListInputSchema.ts @@ -1,10 +1,6 @@ import { z } from 'zod' import { userSchema } from './userSchema' -/** - * @description successful operation - */ -export const createUsersWithListInputErrorSchema = z.any() export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema)) /** diff --git a/examples/zod/src/gen/zod/getInventorySchema.ts b/examples/zod/src/gen/zod/getInventorySchema.ts index 2bb41d50e..5461874af 100644 --- a/examples/zod/src/gen/zod/getInventorySchema.ts +++ b/examples/zod/src/gen/zod/getInventorySchema.ts @@ -3,4 +3,4 @@ import { z } from 'zod' /** * @description successful operation */ -export const getInventoryQueryResponseSchema = z.object({}).catchall(z.number().min(-2147483648).max(2147483647)) +export const getInventoryQueryResponseSchema = z.object({}).catchall(z.number()) diff --git a/examples/zod/src/gen/zod/logoutUserSchema.ts b/examples/zod/src/gen/zod/logoutUserSchema.ts index 43123061a..92cf0018a 100644 --- a/examples/zod/src/gen/zod/logoutUserSchema.ts +++ b/examples/zod/src/gen/zod/logoutUserSchema.ts @@ -1,7 +1,3 @@ import { z } from 'zod' -/** - * @description successful operation - */ -export const logoutUserErrorSchema = z.any() export const logoutUserQueryResponseSchema = z.any() diff --git a/examples/zod/src/gen/zod/updateUserSchema.ts b/examples/zod/src/gen/zod/updateUserSchema.ts index e179ce68e..b00c4566b 100644 --- a/examples/zod/src/gen/zod/updateUserSchema.ts +++ b/examples/zod/src/gen/zod/updateUserSchema.ts @@ -1,10 +1,6 @@ import { z } from 'zod' import { userSchema } from './userSchema' -/** - * @description successful operation - */ -export const updateUserErrorSchema = z.any() export const updateUserMutationResponseSchema = z.any() export const updateUserPathParamsSchema = z.object({ username: z.string().describe(`name that need to be deleted`) }) diff --git a/examples/zodios/package.json b/examples/zodios/package.json index ba6ad2ede..bd901f3d8 100644 --- a/examples/zodios/package.json +++ b/examples/zodios/package.json @@ -40,7 +40,7 @@ "@kubb/ts-config": "workspace:*", "@types/cors": "^2.8.17", "@types/express": "^4.17.21", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "packageManager": "pnpm@8.3.0", diff --git a/examples/zodios/src/gen/zod/createUserSchema.ts b/examples/zodios/src/gen/zod/createUserSchema.ts index 59f494825..e956f68b4 100644 --- a/examples/zodios/src/gen/zod/createUserSchema.ts +++ b/examples/zodios/src/gen/zod/createUserSchema.ts @@ -3,11 +3,6 @@ import { userSchema } from './userSchema' export const createUserMutationResponseSchema = z.any() -/** - * @description successful operation - */ -export const createUserErrorSchema = z.lazy(() => userSchema) - /** * @description Created user object */ diff --git a/examples/zodios/src/gen/zod/createUsersWithListInputSchema.ts b/examples/zodios/src/gen/zod/createUsersWithListInputSchema.ts index 8ca7dd89e..eaac93fed 100644 --- a/examples/zodios/src/gen/zod/createUsersWithListInputSchema.ts +++ b/examples/zodios/src/gen/zod/createUsersWithListInputSchema.ts @@ -1,10 +1,6 @@ import { z } from 'zod' import { userSchema } from './userSchema' -/** - * @description successful operation - */ -export const createUsersWithListInputErrorSchema = z.any() export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema)) /** diff --git a/examples/zodios/src/gen/zod/getInventorySchema.ts b/examples/zodios/src/gen/zod/getInventorySchema.ts index 2bb41d50e..5461874af 100644 --- a/examples/zodios/src/gen/zod/getInventorySchema.ts +++ b/examples/zodios/src/gen/zod/getInventorySchema.ts @@ -3,4 +3,4 @@ import { z } from 'zod' /** * @description successful operation */ -export const getInventoryQueryResponseSchema = z.object({}).catchall(z.number().min(-2147483648).max(2147483647)) +export const getInventoryQueryResponseSchema = z.object({}).catchall(z.number()) diff --git a/examples/zodios/src/gen/zod/logoutUserSchema.ts b/examples/zodios/src/gen/zod/logoutUserSchema.ts index 43123061a..92cf0018a 100644 --- a/examples/zodios/src/gen/zod/logoutUserSchema.ts +++ b/examples/zodios/src/gen/zod/logoutUserSchema.ts @@ -1,7 +1,3 @@ import { z } from 'zod' -/** - * @description successful operation - */ -export const logoutUserErrorSchema = z.any() export const logoutUserQueryResponseSchema = z.any() diff --git a/examples/zodios/src/gen/zod/updateUserSchema.ts b/examples/zodios/src/gen/zod/updateUserSchema.ts index e179ce68e..b00c4566b 100644 --- a/examples/zodios/src/gen/zod/updateUserSchema.ts +++ b/examples/zodios/src/gen/zod/updateUserSchema.ts @@ -1,10 +1,6 @@ import { z } from 'zod' import { userSchema } from './userSchema' -/** - * @description successful operation - */ -export const updateUserErrorSchema = z.any() export const updateUserMutationResponseSchema = z.any() export const updateUserPathParamsSchema = z.object({ username: z.string().describe(`name that need to be deleted`) }) diff --git a/package.json b/package.json index e5e902225..60bdda319 100644 --- a/package.json +++ b/package.json @@ -60,19 +60,19 @@ "@changesets/cli": "^2.27.1", "@kubb/eslint-config": "workspace:*", "@kubb/ts-config": "workspace:*", - "@types/node": "^20.11.16", - "@vitest/coverage-v8": "^1.2.2", - "@vitest/ui": "^1.2.2", - "bun-types": "^1.0.25", + "@types/node": "^20.11.19", + "@vitest/coverage-v8": "^1.3.0", + "@vitest/ui": "^1.3.0", + "bun-types": "^1.0.27", "dprint": "^0.45.0", - "prettier": "^3.2.4", + "prettier": "^3.2.5", "prettier-eslint": "^16.3.0", "rimraf": "^5.0.5", "ts-node": "^10.9.2", - "turbo": "^1.12.2", + "turbo": "^1.12.4", "typescript": "^5.3.3", "vite-tsconfig-paths": "^4.3.1", - "vitest": "^1.2.2" + "vitest": "^1.3.0" }, "packageManager": "pnpm@8.3.0", "engines": { diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 22a2533bf..e06f2c9d4 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,26 @@ # @kubb/cli +## 2.6.2 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.2 + +## 2.6.1 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.1 + +## 2.6.0 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.0 + ## 2.5.3 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index a4cd2e2b6..8358a77e2 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/cli", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator cli", "keywords": [ "typescript", @@ -53,7 +53,7 @@ "@kubb/core": "workspace:*", "bundle-require": "^4.0.2", "cac": "^6.7.14", - "chokidar": "^3.5.3", + "chokidar": "^3.6.0", "cosmiconfig": "^9.0.0", "esbuild": "^0.19.12", "execa": "^8.0.1", @@ -66,9 +66,9 @@ "@kubb/swagger": "workspace:*", "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "@types/node": "^20.11.16", + "@types/node": "^20.11.19", "source-map-support": "^0.5.21", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "packageManager": "pnpm@8.3.0", diff --git a/packages/config/eslint-config/package.json b/packages/config/eslint-config/package.json index 5def47bef..282524b5d 100644 --- a/packages/config/eslint-config/package.json +++ b/packages/config/eslint-config/package.json @@ -45,26 +45,26 @@ "dependencies": { "@eslint/js": "^8.56.0", "@types/eslint": "~8.56.2", - "@typescript-eslint/eslint-plugin": "^6.20.0", - "@typescript-eslint/parser": "~6.15.0", + "@typescript-eslint/eslint-plugin": "^7.0.1", + "@typescript-eslint/parser": "~7.0.1", "eslint-config-prettier": "~9.1.0", - "eslint-config-turbo": "^1.12.2", + "eslint-config-turbo": "^1.12.4", "eslint-formatter-pretty": "^6.0.1", - "eslint-plugin-eslint-plugin": "^5.2.1", + "eslint-plugin-eslint-plugin": "^5.3.0", "eslint-plugin-import": "~2.29.1", "eslint-plugin-react": "~7.33.2", - "eslint-plugin-simple-import-sort": "^10.0.0", - "eslint-plugin-turbo": "^1.12.2", - "eslint-plugin-unused-imports": "~3.0.0", - "eslint-plugin-vitest": "~0.3.21", + "eslint-plugin-simple-import-sort": "^12.0.0", + "eslint-plugin-turbo": "^1.12.4", + "eslint-plugin-unused-imports": "~3.1.0", + "eslint-plugin-vitest": "~0.3.22", "eslint-plugin-vitest-globals": "~1.4.0", - "globals": "^13.24.0" + "globals": "^14.0.0" }, "devDependencies": { "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", "eslint": "^8.56.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "packageManager": "pnpm@8.3.0", diff --git a/packages/config/tsup-config/package.json b/packages/config/tsup-config/package.json index ed581dd7d..1a2cf89e8 100644 --- a/packages/config/tsup-config/package.json +++ b/packages/config/tsup-config/package.json @@ -33,18 +33,18 @@ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false" }, "dependencies": { - "@microsoft/api-extractor": "^7.39.4", + "@microsoft/api-extractor": "^7.40.2", "esbuild-plugin-file-path-extensions": "^2.0.0", "fast-glob": "^3.3.2", "tinyrainbow": "^1.1.1" }, "devDependencies": { "@kubb/ts-config": "workspace:*", - "@types/node": "^20.11.16", - "tsup": "^8.0.1" + "@types/node": "^20.11.19", + "tsup": "^8.0.2" }, "peerDependencies": { - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "packageManager": "pnpm@8.3.0", "engines": { diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 76a54d2c8..4e921df2c 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,29 @@ # @kubb/core +## 2.6.2 + +### Patch Changes + +- Updated dependencies []: + - @kubb/parser@2.6.2 + - @kubb/types@2.6.2 + +## 2.6.1 + +### Patch Changes + +- Updated dependencies []: + - @kubb/parser@2.6.1 + - @kubb/types@2.6.1 + +## 2.6.0 + +### Patch Changes + +- Updated dependencies []: + - @kubb/parser@2.6.0 + - @kubb/types@2.6.0 + ## 2.5.3 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index 4981c75b9..34c141dfb 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/core", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator core", "keywords": [ "typescript", @@ -80,7 +80,7 @@ "dependencies": { "@kubb/parser": "workspace:*", "@kubb/types": "workspace:*", - "change-case": "^5.4.2", + "change-case": "^5.4.3", "directory-tree": "^3.5.1", "find-up": "^7.0.0", "fs-extra": "^11.2.0", @@ -88,7 +88,7 @@ "natural-orderby": "^3.0.2", "p-queue": "^8.0.1", "seedrandom": "^3.0.5", - "semver": "^7.5.4" + "semver": "^7.6.0" }, "devDependencies": { "@kubb/eslint-config": "workspace:*", @@ -96,14 +96,14 @@ "@kubb/tsup-config": "workspace:*", "@types/fs-extra": "^11.0.4", "@types/lodash.isequal": "^4.5.8", - "@types/react": "^18.2.52", + "@types/react": "^18.2.56", "@types/seedrandom": "^3.0.8", - "@types/semver": "^7.5.6", + "@types/semver": "^7.5.7", "eslint": "^8.56.0", "lodash.isequal": "^4.5.0", "ora": "^8.0.1", "tinyrainbow": "^1.1.1", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "packageManager": "pnpm@8.3.0", diff --git a/packages/kubb/package.json b/packages/kubb/package.json index 114d506b1..39c60abb7 100644 --- a/packages/kubb/package.json +++ b/packages/kubb/package.json @@ -49,8 +49,8 @@ "devDependencies": { "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "@types/node": "^20.11.16", - "tsup": "^8.0.1", + "@types/node": "^20.11.19", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "packageManager": "pnpm@8.3.0", diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 7b7dd8ab8..086a0a060 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -1,5 +1,11 @@ # @kubb/parser +## 2.6.2 + +## 2.6.1 + +## 2.6.0 + ## 2.5.3 ## 2.5.2 diff --git a/packages/parser/package.json b/packages/parser/package.json index 4e8870905..335d4c927 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/parser", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator parser", "keywords": [ "typescript", @@ -59,7 +59,7 @@ "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", "eslint": "^8.56.0", - "tsup": "^8.0.1" + "tsup": "^8.0.2" }, "packageManager": "pnpm@8.3.0", "engines": { diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index bc096a078..0c5507ed7 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,29 @@ # @kubb/react +## 2.6.2 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.2 + - @kubb/parser@2.6.2 + +## 2.6.1 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.1 + - @kubb/parser@2.6.1 + +## 2.6.0 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.0 + - @kubb/parser@2.6.0 + ## 2.5.3 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index 4b750a82f..48345f5c6 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/react", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator react", "keywords": [ "typescript", @@ -76,12 +76,12 @@ "@kubb/eslint-config": "workspace:*", "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "@types/react": "^18.2.52", + "@types/react": "^18.2.56", "@types/react-reconciler": "^0.28.8", "eslint": "^8.56.0", "react": "^18.2.0", "react-reconciler": "^0.29.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "packageManager": "pnpm@8.3.0", diff --git a/packages/react/src/shared/utils/throttle.ts b/packages/react/src/shared/utils/throttle.ts index aeeaba877..83fca6bd7 100644 --- a/packages/react/src/shared/utils/throttle.ts +++ b/packages/react/src/shared/utils/throttle.ts @@ -18,7 +18,7 @@ export const throttle = (fn: (...args: A) => R, delay: numbe timeout = setTimeout(() => { wait = false - }, delay) + }, delay) as NodeJS.Timeout return val }, diff --git a/packages/swagger-client/CHANGELOG.md b/packages/swagger-client/CHANGELOG.md index e5ea25874..7433c1b08 100644 --- a/packages/swagger-client/CHANGELOG.md +++ b/packages/swagger-client/CHANGELOG.md @@ -1,5 +1,38 @@ # @kubb/swagger-client +## 2.6.2 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.2 + - @kubb/parser@2.6.2 + - @kubb/react@2.6.2 + - @kubb/swagger@2.6.2 + - @kubb/swagger-ts@2.6.2 + +## 2.6.1 + +### Patch Changes + +- Updated dependencies [[`69897f5`](https://github.com/kubb-project/kubb/commit/69897f5ab4097ec1970b874d724319fb1e1e7f30)]: + - @kubb/swagger-ts@2.6.1 + - @kubb/swagger@2.6.1 + - @kubb/core@2.6.1 + - @kubb/parser@2.6.1 + - @kubb/react@2.6.1 + +## 2.6.0 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.0 + - @kubb/parser@2.6.0 + - @kubb/react@2.6.0 + - @kubb/swagger@2.6.0 + - @kubb/swagger-ts@2.6.0 + ## 2.5.3 ### Patch Changes diff --git a/packages/swagger-client/package.json b/packages/swagger-client/package.json index c2db64214..6813638b7 100644 --- a/packages/swagger-client/package.json +++ b/packages/swagger-client/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/swagger-client", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator swagger-client", "keywords": [ "typescript", @@ -78,11 +78,11 @@ "@kubb/eslint-config": "workspace:*", "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "@types/react": "^18.2.52", + "@types/react": "^18.2.56", "axios": "^1.6.7", "eslint": "^8.56.0", "react": "^18.2.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "peerDependencies": { diff --git a/packages/swagger-faker/CHANGELOG.md b/packages/swagger-faker/CHANGELOG.md index f7b9cb0bf..01951d535 100644 --- a/packages/swagger-faker/CHANGELOG.md +++ b/packages/swagger-faker/CHANGELOG.md @@ -1,5 +1,38 @@ # @kubb/swagger-faker +## 2.6.2 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.2 + - @kubb/parser@2.6.2 + - @kubb/react@2.6.2 + - @kubb/swagger@2.6.2 + - @kubb/swagger-ts@2.6.2 + +## 2.6.1 + +### Patch Changes + +- Updated dependencies [[`69897f5`](https://github.com/kubb-project/kubb/commit/69897f5ab4097ec1970b874d724319fb1e1e7f30)]: + - @kubb/swagger-ts@2.6.1 + - @kubb/swagger@2.6.1 + - @kubb/core@2.6.1 + - @kubb/parser@2.6.1 + - @kubb/react@2.6.1 + +## 2.6.0 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.0 + - @kubb/parser@2.6.0 + - @kubb/react@2.6.0 + - @kubb/swagger@2.6.0 + - @kubb/swagger-ts@2.6.0 + ## 2.5.3 ### Patch Changes diff --git a/packages/swagger-faker/package.json b/packages/swagger-faker/package.json index b357594ac..592852513 100644 --- a/packages/swagger-faker/package.json +++ b/packages/swagger-faker/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/swagger-faker", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator swagger-faker", "keywords": [ "faker", @@ -67,10 +67,10 @@ "@kubb/eslint-config": "workspace:*", "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "@types/react": "^18.2.52", + "@types/react": "^18.2.56", "eslint": "^8.56.0", "react": "^18.2.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "peerDependencies": { diff --git a/packages/swagger-faker/src/FakerGenerator.ts b/packages/swagger-faker/src/FakerGenerator.ts index 8de2c627a..9f1bdc199 100644 --- a/packages/swagger-faker/src/FakerGenerator.ts +++ b/packages/swagger-faker/src/FakerGenerator.ts @@ -128,7 +128,7 @@ export class FakerGenerator extends Generator generate x-enum-varnames types 1`] = ` [ " -export function enumVarNames(override?: Partial): NonNullable { +export function enumVarNames(override?: NonNullable>): NonNullable { faker.seed(1) return faker.helpers.arrayElement([\`Pending\`, \`Received\`]); } @@ -14,7 +14,7 @@ export function enumVarNames(override?: Partial): NonNullable generate x-enumNames types 1`] = ` [ " -export function enumNames(override?: Partial): NonNullable { +export function enumNames(override?: NonNullable>): NonNullable { faker.seed(1) return faker.helpers.arrayElement([\`Pending\`, \`Received\`]); } diff --git a/packages/swagger-faker/src/__snapshots__/OperationGenerator.test.tsx.snap b/packages/swagger-faker/src/__snapshots__/OperationGenerator.test.tsx.snap index b2d0cefa8..58fa2d954 100644 --- a/packages/swagger-faker/src/__snapshots__/OperationGenerator.test.tsx.snap +++ b/packages/swagger-faker/src/__snapshots__/OperationGenerator.test.tsx.snap @@ -32,7 +32,7 @@ exports[`OperationGenerator > [DELETE] should generate with unknownType \`any\` }, "override": undefined, "path": "delete_pet-petid.ts", - "source": "export function DeletePetPetidMutationResponse(override?: Partial): NonNullable { + "source": "export function DeletePetPetidMutationResponse(override?: NonNullable>): NonNullable { return undefined; } ", @@ -56,22 +56,6 @@ exports[`OperationGenerator > [GET] should generate 1`] = ` "path": "@faker-js/faker", "root": undefined, }, - { - "isTypeOnly": false, - "name": [ - "Error", - ], - "path": "Error", - "root": "listPets.ts", - }, - { - "isTypeOnly": true, - "name": [ - "ListPetsError", - ], - "path": "ListPets", - "root": "listPets.ts", - }, { "isTypeOnly": true, "name": [ @@ -104,24 +88,17 @@ exports[`OperationGenerator > [GET] should generate 1`] = ` }, "override": undefined, "path": "listPets.ts", - "source": "export function ListPetsQueryParams(override: Partial = {}): NonNullable { + "source": "export function ListPetsQueryParams(override: NonNullable> = {}): NonNullable { return { ...{ "limit": faker.string.alpha() }, ...override }; } -/** - * @description unexpected error - */ - - export function ListPetsError(override?: Partial): NonNullable { - return Error(override); -} /** * @description A paged array of pets */ - export function ListPetsQueryResponse(override?: Partial): NonNullable { + export function ListPetsQueryResponse(override?: NonNullable>): NonNullable { return Pets(override); } ", @@ -145,22 +122,6 @@ exports[`OperationGenerator > [GET] should generate 2`] = ` "path": "@faker-js/faker", "root": undefined, }, - { - "isTypeOnly": false, - "name": [ - "Error", - ], - "path": "Error", - "root": "showPetById.ts", - }, - { - "isTypeOnly": true, - "name": [ - "ShowPetByIdError", - ], - "path": "ShowPetById", - "root": "showPetById.ts", - }, { "isTypeOnly": true, "name": [ @@ -193,24 +154,17 @@ exports[`OperationGenerator > [GET] should generate 2`] = ` }, "override": undefined, "path": "showPetById.ts", - "source": "export function ShowPetByIdPathParams(override: Partial = {}): NonNullable { + "source": "export function ShowPetByIdPathParams(override: NonNullable> = {}): NonNullable { return { ...{ "petId": faker.string.alpha(), "testId": faker.string.alpha() }, ...override }; } -/** - * @description unexpected error - */ - - export function ShowPetByIdError(override?: Partial): NonNullable { - return Error(override); -} /** * @description Expected response to a valid request */ - export function ShowPetByIdQueryResponse(override?: Partial): NonNullable { + export function ShowPetByIdQueryResponse(override?: NonNullable>): NonNullable { return Pet(override); } ", @@ -234,22 +188,6 @@ exports[`OperationGenerator > [GET] should generate with seed \`[222]\` 1`] = ` "path": "@faker-js/faker", "root": undefined, }, - { - "isTypeOnly": false, - "name": [ - "Error", - ], - "path": "Error", - "root": "listPets.ts", - }, - { - "isTypeOnly": true, - "name": [ - "ListPetsError", - ], - "path": "ListPets", - "root": "listPets.ts", - }, { "isTypeOnly": true, "name": [ @@ -282,26 +220,18 @@ exports[`OperationGenerator > [GET] should generate with seed \`[222]\` 1`] = ` }, "override": undefined, "path": "listPets.ts", - "source": "export function ListPetsQueryParams(override: Partial = {}): NonNullable { + "source": "export function ListPetsQueryParams(override: NonNullable> = {}): NonNullable { faker.seed([222]); return { ...{ "limit": faker.string.alpha() }, ...override }; } -/** - * @description unexpected error - */ - - export function ListPetsError(override?: Partial): NonNullable { - faker.seed([222]); - return Error(override); -} /** * @description A paged array of pets */ - export function ListPetsQueryResponse(override?: Partial): NonNullable { + export function ListPetsQueryResponse(override?: NonNullable>): NonNullable { faker.seed([222]); return Pets(override); } @@ -326,22 +256,6 @@ exports[`OperationGenerator > [GET] should generate with seed \`[222]\` 2`] = ` "path": "@faker-js/faker", "root": undefined, }, - { - "isTypeOnly": false, - "name": [ - "Error", - ], - "path": "Error", - "root": "showPetById.ts", - }, - { - "isTypeOnly": true, - "name": [ - "ShowPetByIdError", - ], - "path": "ShowPetById", - "root": "showPetById.ts", - }, { "isTypeOnly": true, "name": [ @@ -374,26 +288,18 @@ exports[`OperationGenerator > [GET] should generate with seed \`[222]\` 2`] = ` }, "override": undefined, "path": "showPetById.ts", - "source": "export function ShowPetByIdPathParams(override: Partial = {}): NonNullable { + "source": "export function ShowPetByIdPathParams(override: NonNullable> = {}): NonNullable { faker.seed([222]); return { ...{ "petId": faker.string.alpha(), "testId": faker.string.alpha() }, ...override }; } -/** - * @description unexpected error - */ - - export function ShowPetByIdError(override?: Partial): NonNullable { - faker.seed([222]); - return Error(override); -} /** * @description Expected response to a valid request */ - export function ShowPetByIdQueryResponse(override?: Partial): NonNullable { + export function ShowPetByIdQueryResponse(override?: NonNullable>): NonNullable { faker.seed([222]); return Pet(override); } @@ -418,30 +324,6 @@ exports[`OperationGenerator > [POST] should generate 1`] = ` "path": "@faker-js/faker", "root": undefined, }, - { - "isTypeOnly": true, - "name": [ - "CreatePets201", - ], - "path": "CreatePets", - "root": "createPets.ts", - }, - { - "isTypeOnly": false, - "name": [ - "Error", - ], - "path": "Error", - "root": "createPets.ts", - }, - { - "isTypeOnly": true, - "name": [ - "CreatePetsError", - ], - "path": "CreatePets", - "root": "createPets.ts", - }, { "isTypeOnly": true, "name": [ @@ -466,31 +348,16 @@ exports[`OperationGenerator > [POST] should generate 1`] = ` }, "override": undefined, "path": "createPets.ts", - "source": "/** - * @description Null response - */ - - export function CreatePets201(override?: Partial): NonNullable { - return undefined; -} - - export function CreatePetsMutationRequest(override: Partial = {}): NonNullable { + "source": "export function CreatePetsMutationRequest(override: NonNullable> = {}): NonNullable { return { ...{ "name": faker.string.alpha(), "tag": faker.string.alpha() }, ...override }; } - export function CreatePetsMutationResponse(override?: Partial): NonNullable { + export function CreatePetsMutationResponse(override?: NonNullable>): NonNullable { return undefined; } -/** - * @description unexpected error - */ - - export function CreatePetsError(override?: Partial): NonNullable { - return Error(override); -} ", }, ] diff --git a/packages/swagger-faker/src/components/__snapshots__/Mutation.test.tsx.snap b/packages/swagger-faker/src/components/__snapshots__/Mutation.test.tsx.snap index ac73f56a0..d970ea328 100644 --- a/packages/swagger-faker/src/components/__snapshots__/Mutation.test.tsx.snap +++ b/packages/swagger-faker/src/components/__snapshots__/Mutation.test.tsx.snap @@ -1,31 +1,15 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[` > pets 1`] = ` -"/** - * @description Null response - */ - -export function createCreatePets201(override?: Partial): NonNullable { - return undefined -} - -export function createCreatePetsMutationRequest(override: Partial = {}): NonNullable { +"export function createCreatePetsMutationRequest(override: NonNullable> = {}): NonNullable { return { ...{ name: faker.string.alpha(), tag: faker.string.alpha() }, ...override, } } -export function createCreatePetsMutationResponse(override?: Partial): NonNullable { +export function createCreatePetsMutationResponse(override?: NonNullable>): NonNullable { return undefined } - -/** - * @description unexpected error - */ - -export function createCreatePetsError(override?: Partial): NonNullable { - return createError(override) -} " `; diff --git a/packages/swagger-faker/src/components/__snapshots__/Query.test.tsx.snap b/packages/swagger-faker/src/components/__snapshots__/Query.test.tsx.snap index b09fbf446..054ecabac 100644 --- a/packages/swagger-faker/src/components/__snapshots__/Query.test.tsx.snap +++ b/packages/swagger-faker/src/components/__snapshots__/Query.test.tsx.snap @@ -1,26 +1,18 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[` > showPetById 1`] = ` -"export function createShowPetByIdPathParams(override: Partial = {}): NonNullable { +"export function createShowPetByIdPathParams(override: NonNullable> = {}): NonNullable { return { ...{ petId: faker.string.alpha(), testId: faker.string.alpha() }, ...override, } } -/** - * @description unexpected error - */ - -export function createShowPetByIdError(override?: Partial): NonNullable { - return createError(override) -} - /** * @description Expected response to a valid request */ -export function createShowPetByIdQueryResponse(override?: Partial): NonNullable { +export function createShowPetByIdQueryResponse(override?: NonNullable>): NonNullable { return createPet(override) } " diff --git a/packages/swagger-faker/src/fakerParser.test.ts b/packages/swagger-faker/src/fakerParser.test.ts index 502889cd6..a3606a4fd 100644 --- a/packages/swagger-faker/src/fakerParser.test.ts +++ b/packages/swagger-faker/src/fakerParser.test.ts @@ -48,7 +48,7 @@ const input = [ { input: parseFakerMeta({ keyword: 'ref', - args: 'createPet', + args: { name: 'createPet' }, }), expected: 'createPet()', }, @@ -85,7 +85,7 @@ const input = [ { input: parseFakerMeta({ keyword: 'array', - args: [{ keyword: 'ref', args: 'createPet' }], + args: [{ keyword: 'ref', args: { name: 'createPet' } }], }), expected: 'faker.helpers.arrayElements([createPet()]) as any', }, @@ -132,8 +132,10 @@ const input = [ input: parseFakerMeta({ keyword: 'object', args: { - firstName: [{ keyword: 'string', args: { min: 2 } }], - address: [{ keyword: 'string' }, { keyword: 'null' }], + entries: { + firstName: [{ keyword: 'string', args: { min: 2 } }], + address: [{ keyword: 'string' }, { keyword: 'null' }], + }, }, }), expected: '{"firstName": faker.string.alpha({"min":2}),"address": faker.helpers.arrayElement([faker.string.alpha(),null])}', diff --git a/packages/swagger-faker/src/fakerParser.ts b/packages/swagger-faker/src/fakerParser.ts index 7c4fc269d..bd2f57f90 100644 --- a/packages/swagger-faker/src/fakerParser.ts +++ b/packages/swagger-faker/src/fakerParser.ts @@ -1,3 +1,31 @@ +export type FakerMetaMapper = { + object: { keyword: 'object'; args: { entries: { [x: string]: FakerMeta[] }; strict?: boolean } } + url: { keyword: 'url' } + uuid: { keyword: 'uuid' } + email: { keyword: 'email' } + firstName: { keyword: 'firstName' } + lastName: { keyword: 'lastName' } + phone: { keyword: 'phone' } + password: { keyword: 'password' } + datetime: { keyword: 'datetime' } + tuple: { keyword: 'tuple'; args?: FakerMeta[] } + array: { keyword: 'array'; args?: FakerMeta[] } + enum: { keyword: 'enum'; args?: Array } + and: { keyword: 'and'; args?: FakerMeta[] } + union: { keyword: 'union'; args?: FakerMeta[] } + ref: { keyword: 'ref'; args?: { name: string } } + catchall: { keyword: 'catchall'; args?: FakerMeta[] } + matches: { keyword: 'matches'; args?: string } + boolean: { keyword: 'boolean' } + string: { keyword: 'string'; args?: { min?: number; max?: number } } + integer: { keyword: 'integer'; args?: { min?: number; max?: number } } + number: { keyword: 'number'; args?: { min?: number; max?: number } } + undefined: { keyword: 'undefined' } + null: { keyword: 'null' } + any: { keyword: 'any' } + unknown: { keyword: 'unknown' } +} + export const fakerKeywords = { any: 'any', unknown: 'unknown', @@ -27,7 +55,7 @@ export const fakerKeywords = { lastName: 'lastName', password: 'password', phone: 'phone', -} as const +} satisfies { [K in keyof FakerMetaMapper]: FakerMetaMapper[K]['keyword'] } export type FakerKeyword = keyof typeof fakerKeywords @@ -60,86 +88,21 @@ export const fakerKeywordMapper = { lastName: 'faker.person.lastName', password: 'faker.internet.password', phone: 'faker.phone.number', -} as const satisfies Record +} satisfies { [K in keyof FakerMetaMapper]: string } type FakerMetaBase = { keyword: FakerKeyword args: T } -type FakerMetaUnknown = { keyword: typeof fakerKeywords.unknown } - -type FakerMetaAny = { keyword: typeof fakerKeywords.any } -type FakerMetaNull = { keyword: typeof fakerKeywords.null } -type FakerMetaUndefined = { keyword: typeof fakerKeywords.undefined } - -type FakerMetaNumber = { keyword: typeof fakerKeywords.number; args?: { min?: number; max?: number } } -type FakerMetaInteger = { keyword: typeof fakerKeywords.integer; args?: { min?: number; max?: number } } - -type FakerMetaString = { keyword: typeof fakerKeywords.string; args?: { min?: number; max?: number } } - -type FakerMetaBoolean = { keyword: typeof fakerKeywords.boolean } - -type FakerMetaMatches = { keyword: typeof fakerKeywords.matches; args?: string } - -type FakerMetaObject = { keyword: typeof fakerKeywords.object; args?: { [x: string]: FakerMeta[] } } - -type FakerMetaCatchall = { keyword: typeof fakerKeywords.catchall; args?: FakerMeta[] } - -type FakerMetaRef = { keyword: typeof fakerKeywords.ref; args?: string } - -type FakerMetaUnion = { keyword: typeof fakerKeywords.union; args?: FakerMeta[] } - -type FakerMetaAnd = { keyword: typeof fakerKeywords.and; args?: FakerMeta[] } - -type FakerMetaEnum = { keyword: typeof fakerKeywords.enum; args?: Array } - -type FakerMetaArray = { keyword: typeof fakerKeywords.array; args?: FakerMeta[] } - -type FakerMetaTuple = { keyword: typeof fakerKeywords.tuple; args?: FakerMeta[] } -type FakerMetaEmail = { keyword: typeof fakerKeywords.email } - -type FakerMetaFirstName = { keyword: typeof fakerKeywords.firstName } - -type FakerMetaLastName = { keyword: typeof fakerKeywords.lastName } -type FakerMetaPassword = { keyword: typeof fakerKeywords.password } - -type FakerMetaPhone = { keyword: typeof fakerKeywords.phone } - -type FakerMetaDatetime = { keyword: typeof fakerKeywords.datetime } - -type FakerMetaUuid = { keyword: typeof fakerKeywords.uuid } - -type FakerMetaUrl = { keyword: typeof fakerKeywords.url } - export type FakerMeta = | { keyword: string } - | FakerMetaUnknown - | FakerMetaAny - | FakerMetaNull - | FakerMetaUndefined - | FakerMetaNumber - | FakerMetaInteger - | FakerMetaString - | FakerMetaBoolean - | FakerMetaMatches - | FakerMetaObject - | FakerMetaCatchall - | FakerMetaRef - | FakerMetaUnion - | FakerMetaAnd - | FakerMetaEnum - | FakerMetaArray - | FakerMetaTuple - | FakerMetaEmail - | FakerMetaFirstName - | FakerMetaLastName - | FakerMetaPassword - | FakerMetaPhone - | FakerMetaDatetime - | FakerMetaUuid - | FakerMetaUrl -// use example + | FakerMetaMapper[keyof FakerMetaMapper] + +export function isKeyword(meta: T, keyword: K): meta is Extract { + return meta.keyword === keyword +} + /** * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398 */ @@ -164,45 +127,42 @@ function joinItems(items: string[]): string { } export function parseFakerMeta( - item: FakerMeta, + item: FakerMeta = {} as FakerMeta, { mapper = fakerKeywordMapper, withOverride }: { mapper?: Record; withOverride?: boolean } = {}, ): string { - // eslint-disable-next-line prefer-const - let { keyword, args } = (item || {}) as FakerMetaBase - const value = mapper[keyword] + const value = mapper[item.keyword as keyof typeof mapper] - if (keyword === fakerKeywords.tuple || keyword === fakerKeywords.array || keyword === fakerKeywords.union) { + if (isKeyword(item, fakerKeywords.tuple) || isKeyword(item, fakerKeywords.array) || isKeyword(item, fakerKeywords.union)) { return `${value}(${ - Array.isArray(args) ? `[${args.map((item) => parseFakerMeta(item as FakerMeta, { mapper })).join(',')}]` : parseFakerMeta(args as FakerMeta) + Array.isArray(item.args) + ? `[${item.args.map((orItem) => parseFakerMeta(orItem, { mapper })).join(',')}]` + : parseFakerMeta(item.args) }) as any` } - if (keyword === fakerKeywords.and) { + if (isKeyword(item, fakerKeywords.and)) { return `${value}({},${ - Array.isArray(args) ? `${args.map((item) => parseFakerMeta(item as FakerMeta, { mapper })).join(',')}` : parseFakerMeta(args as FakerMeta) + Array.isArray(item.args) ? `${item.args.map((andItem) => parseFakerMeta(andItem, { mapper })).join(',')}` : parseFakerMeta(item.args) })` } - if (keyword === fakerKeywords.enum) { - return `${value}(${Array.isArray(args) ? `${args.join(',')}` : parseFakerMeta(args as FakerMeta)})` + if (isKeyword(item, fakerKeywords.enum)) { + return `${value}(${Array.isArray(item.args) ? `${item.args.join(',')}` : parseFakerMeta(item.args)})` } - if (keyword === fakerKeywords.catchall) { + if (isKeyword(item, fakerKeywords.catchall)) { throw new Error('catchall is not implemented') } - if (keyword === fakerKeywords.object) { - if (!args) { - args = '{}' - } - const argsObject = Object.entries(args as FakerMeta) + if (isKeyword(item, fakerKeywords.object)) { + const argsObject = Object.entries(item.args?.entries || '{}') .filter((item) => { - const schema = item[1] as FakerMeta[] + const schema = item[1] return schema && typeof schema.map === 'function' }) .map((item) => { const name = item[0] - const schema = item[1] as FakerMeta[] + const schema = item[1] return `"${name}": ${ joinItems( schema @@ -217,19 +177,23 @@ export function parseFakerMeta( } // custom type - if (keyword === fakerKeywords.ref) { + if (isKeyword(item, fakerKeywords.ref)) { + if (!item.args?.name) { + throw new Error(`Name not defined for keyword ${item.keyword}`) + } + if (withOverride) { - return `${args as string}(override)` + return `${item.args.name}(override)` } - return `${args as string}()` + return `${item.args.name}()` } - if (keyword === fakerKeywords.null || keyword === fakerKeywords.undefined || keyword === fakerKeywords.any) { + if (isKeyword(item, fakerKeywords.null) || isKeyword(item, fakerKeywords.undefined) || isKeyword(item, fakerKeywords.any)) { return value } - if (keyword in mapper) { - const options = JSON.stringify(args) + if (item.keyword in mapper) { + const options = JSON.stringify((item as FakerMetaBase).args) return `${value}(${options ?? ''})` } @@ -265,7 +229,9 @@ export function fakerParser( return ` export function ${options.name}(${ - fakerDefaultOverride ? `override: Partial<${options.typeName}> = ${fakerDefaultOverride}` : `override?: Partial<${options.typeName}>` + fakerDefaultOverride + ? `override: NonNullable> = ${fakerDefaultOverride}` + : `override?: NonNullable>` })${options.typeName ? `: NonNullable<${options.typeName}>` : ''} { ${options.seed ? `faker.seed(${JSON.stringify(options.seed)})` : ''} return ${fakerTextWithOverride}; diff --git a/packages/swagger-msw/CHANGELOG.md b/packages/swagger-msw/CHANGELOG.md index a347898d8..39e3a0662 100644 --- a/packages/swagger-msw/CHANGELOG.md +++ b/packages/swagger-msw/CHANGELOG.md @@ -1,5 +1,41 @@ # @kubb/swagger-msw +## 2.6.2 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.2 + - @kubb/parser@2.6.2 + - @kubb/react@2.6.2 + - @kubb/swagger@2.6.2 + - @kubb/swagger-faker@2.6.2 + - @kubb/swagger-ts@2.6.2 + +## 2.6.1 + +### Patch Changes + +- Updated dependencies [[`69897f5`](https://github.com/kubb-project/kubb/commit/69897f5ab4097ec1970b874d724319fb1e1e7f30)]: + - @kubb/swagger-ts@2.6.1 + - @kubb/swagger@2.6.1 + - @kubb/swagger-faker@2.6.1 + - @kubb/core@2.6.1 + - @kubb/parser@2.6.1 + - @kubb/react@2.6.1 + +## 2.6.0 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.0 + - @kubb/parser@2.6.0 + - @kubb/react@2.6.0 + - @kubb/swagger@2.6.0 + - @kubb/swagger-faker@2.6.0 + - @kubb/swagger-ts@2.6.0 + ## 2.5.3 ### Patch Changes diff --git a/packages/swagger-msw/package.json b/packages/swagger-msw/package.json index 97e9d1b91..bcf5747cd 100644 --- a/packages/swagger-msw/package.json +++ b/packages/swagger-msw/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/swagger-msw", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator swagger-msw", "keywords": [ "faker", @@ -69,10 +69,10 @@ "@kubb/eslint-config": "workspace:*", "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "@types/react": "^18.2.52", + "@types/react": "^18.2.56", "eslint": "^8.56.0", "react": "^18.2.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "peerDependencies": { diff --git a/packages/swagger-swr/CHANGELOG.md b/packages/swagger-swr/CHANGELOG.md index eee38722f..d66752b35 100644 --- a/packages/swagger-swr/CHANGELOG.md +++ b/packages/swagger-swr/CHANGELOG.md @@ -1,5 +1,41 @@ # @kubb/swagger-swr +## 2.6.2 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.2 + - @kubb/parser@2.6.2 + - @kubb/react@2.6.2 + - @kubb/swagger@2.6.2 + - @kubb/swagger-client@2.6.2 + - @kubb/swagger-ts@2.6.2 + +## 2.6.1 + +### Patch Changes + +- Updated dependencies [[`69897f5`](https://github.com/kubb-project/kubb/commit/69897f5ab4097ec1970b874d724319fb1e1e7f30)]: + - @kubb/swagger-ts@2.6.1 + - @kubb/swagger@2.6.1 + - @kubb/swagger-client@2.6.1 + - @kubb/core@2.6.1 + - @kubb/parser@2.6.1 + - @kubb/react@2.6.1 + +## 2.6.0 + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.0 + - @kubb/parser@2.6.0 + - @kubb/react@2.6.0 + - @kubb/swagger@2.6.0 + - @kubb/swagger-client@2.6.0 + - @kubb/swagger-ts@2.6.0 + ## 2.5.3 ### Patch Changes diff --git a/packages/swagger-swr/package.json b/packages/swagger-swr/package.json index 85c95efc4..7828ad09e 100644 --- a/packages/swagger-swr/package.json +++ b/packages/swagger-swr/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/swagger-swr", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator swagger-swr", "keywords": [ "typescript", @@ -70,10 +70,10 @@ "@kubb/eslint-config": "workspace:*", "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "@types/react": "^18.2.52", + "@types/react": "^18.2.56", "eslint": "^8.56.0", "react": "^18.2.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "peerDependencies": { diff --git a/packages/swagger-swr/src/components/__snapshots__/Mutation.test.tsx.snap b/packages/swagger-swr/src/components/__snapshots__/Mutation.test.tsx.snap index 23efa1528..ad19f1c03 100644 --- a/packages/swagger-swr/src/components/__snapshots__/Mutation.test.tsx.snap +++ b/packages/swagger-swr/src/components/__snapshots__/Mutation.test.tsx.snap @@ -1,10 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[` > pets 1`] = ` -"type CreatePetsClient = typeof client +"type CreatePetsClient = typeof client type CreatePets = { data: CreatePetsMutationResponse - error: CreatePets201 | CreatePetsError + error: never request: CreatePetsMutationRequest pathParams: never queryParams: never diff --git a/packages/swagger-swr/src/components/__snapshots__/Query.test.tsx.snap b/packages/swagger-swr/src/components/__snapshots__/Query.test.tsx.snap index 6c4d4e174..9e851920e 100644 --- a/packages/swagger-swr/src/components/__snapshots__/Query.test.tsx.snap +++ b/packages/swagger-swr/src/components/__snapshots__/Query.test.tsx.snap @@ -1,10 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[` > showPetById 1`] = ` -"type ShowPetByIdClient = typeof client +"type ShowPetByIdClient = typeof client type ShowPetById = { data: ShowPetByIdQueryResponse - error: ShowPetByIdError + error: never request: never pathParams: ShowPetByIdPathParams queryParams: never diff --git a/packages/swagger-tanstack-query/CHANGELOG.md b/packages/swagger-tanstack-query/CHANGELOG.md index d65af0f16..dfe7cd9fb 100644 --- a/packages/swagger-tanstack-query/CHANGELOG.md +++ b/packages/swagger-tanstack-query/CHANGELOG.md @@ -1,5 +1,48 @@ # @kubb/swagger-tanstack-query +## 2.6.2 + +### Patch Changes + +- Updated dependencies [[`a18fe79`](https://github.com/kubb-project/kubb/commit/a18fe7996907a5a7615cdde049d5d97e98fcf0c7)]: + - @kubb/swagger-zod@2.6.2 + - @kubb/core@2.6.2 + - @kubb/parser@2.6.2 + - @kubb/react@2.6.2 + - @kubb/swagger@2.6.2 + - @kubb/swagger-client@2.6.2 + - @kubb/swagger-ts@2.6.2 + +## 2.6.1 + +### Patch Changes + +- Updated dependencies [[`69897f5`](https://github.com/kubb-project/kubb/commit/69897f5ab4097ec1970b874d724319fb1e1e7f30), [`1383571`](https://github.com/kubb-project/kubb/commit/1383571a360257adff728265735283fa45ba8e94)]: + - @kubb/swagger-ts@2.6.1 + - @kubb/swagger@2.6.1 + - @kubb/swagger-zod@2.6.1 + - @kubb/swagger-client@2.6.1 + - @kubb/core@2.6.1 + - @kubb/parser@2.6.1 + - @kubb/react@2.6.1 + +## 2.6.0 + +### Minor Changes + +- [`e7f3612`](https://github.com/kubb-project/kubb/commit/e7f3612093927c42c88090997496570ba47864a0) Thanks [@stijnvanhulle](https://github.com/stijnvanhulle)! - override queryKey of @tanstack/query + +### Patch Changes + +- Updated dependencies []: + - @kubb/core@2.6.0 + - @kubb/parser@2.6.0 + - @kubb/react@2.6.0 + - @kubb/swagger@2.6.0 + - @kubb/swagger-client@2.6.0 + - @kubb/swagger-ts@2.6.0 + - @kubb/swagger-zod@2.6.0 + ## 2.5.3 ### Patch Changes diff --git a/packages/swagger-tanstack-query/package.json b/packages/swagger-tanstack-query/package.json index fea3b937f..7534760e6 100644 --- a/packages/swagger-tanstack-query/package.json +++ b/packages/swagger-tanstack-query/package.json @@ -1,6 +1,6 @@ { "name": "@kubb/swagger-tanstack-query", - "version": "2.5.3", + "version": "2.6.2", "description": "Generator swagger-tanstack-query", "keywords": [ "typescript", @@ -70,10 +70,10 @@ "@kubb/eslint-config": "workspace:*", "@kubb/ts-config": "workspace:*", "@kubb/tsup-config": "workspace:*", - "@types/react": "^18.2.52", + "@types/react": "^18.2.56", "eslint": "^8.56.0", "react": "^18.2.0", - "tsup": "^8.0.1", + "tsup": "^8.0.2", "typescript": "^5.3.3" }, "peerDependencies": { diff --git a/packages/swagger-tanstack-query/src/components/Mutation.test.tsx b/packages/swagger-tanstack-query/src/components/Mutation.test.tsx index 1abe6a61c..6d8bbeb88 100644 --- a/packages/swagger-tanstack-query/src/components/Mutation.test.tsx +++ b/packages/swagger-tanstack-query/src/components/Mutation.test.tsx @@ -44,6 +44,7 @@ describe('', async () => { importPath: '@kubb/swagger-client/client', }, parser: undefined, + query: {}, } const plugin = { options } as Plugin diff --git a/packages/swagger-tanstack-query/src/components/Query.test.tsx b/packages/swagger-tanstack-query/src/components/Query.test.tsx index 66f4a795e..5560631e0 100644 --- a/packages/swagger-tanstack-query/src/components/Query.test.tsx +++ b/packages/swagger-tanstack-query/src/components/Query.test.tsx @@ -45,6 +45,7 @@ describe('', async () => { importPath: '@kubb/swagger-client/client', }, parser: undefined, + query: {}, } const plugin = { options } as Plugin diff --git a/packages/swagger-tanstack-query/src/components/Query.tsx b/packages/swagger-tanstack-query/src/components/Query.tsx index 43a419b8c..3e70d0611 100644 --- a/packages/swagger-tanstack-query/src/components/Query.tsx +++ b/packages/swagger-tanstack-query/src/components/Query.tsx @@ -14,6 +14,7 @@ import { QueryOptions } from './QueryOptions.tsx' import { SchemaType } from './SchemaType.tsx' import type { ReactNode } from 'react' +import type { Query as QueryPluginOptions } from '../types.ts' import type { FileMeta, Infinite, PluginOptions, Suspense } from '../types.ts' type TemplateProps = { @@ -71,7 +72,7 @@ function Template({ const query = ${hook.name}({ ...${hook.queryOptions} as ${infinite ? 'InfiniteQueryObserverOptions' : 'QueryObserverOptions'}, queryKey, - ...queryOptions as unknown as ${infinite ? 'InfiniteQueryObserverOptions' : 'QueryObserverOptions'} + ...queryOptions as unknown as ${infinite ? 'Omit' : 'Omit'} }) as ${resolvedReturnType} query.queryKey = queryKey as TQueryKey @@ -257,6 +258,7 @@ type Props = { hookName: string optionsType: string infinite: Infinite | undefined + query: QueryPluginOptions | undefined suspense: Suspense | undefined /** * This will make it possible to override the default behaviour. @@ -276,6 +278,7 @@ export function Query({ factory, infinite, suspense, + query, optionsType, hookName, resultType, @@ -391,7 +394,7 @@ export function Query({ return ( <> - + () + const { options: { client: { importPath }, framework, infinite, suspense, query, parser } } = usePlugin() const schemas = useSchemas() const file = useOperationFile() const fileType = useOperationFile({ pluginKey: swaggerTsPluginKey }) @@ -488,6 +491,7 @@ Query.File = function({ templates, imports = QueryImports.templates }: FileProps QueryOptionsTemplate={QueryOptionsTemplate} infinite={undefined} suspense={undefined} + query={query} hookName={importNames.query[framework].hookName} resultType={importNames.query[framework].resultType} optionsType={importNames.query[framework].optionsType} @@ -500,6 +504,7 @@ Query.File = function({ templates, imports = QueryImports.templates }: FileProps QueryOptionsTemplate={QueryOptionsTemplate} infinite={infinite} suspense={undefined} + query={query} hookName={importNames.queryInfinite[framework].hookName} resultType={importNames.queryInfinite[framework].resultType} optionsType={importNames.queryInfinite[framework].optionsType} @@ -513,6 +518,7 @@ Query.File = function({ templates, imports = QueryImports.templates }: FileProps QueryOptionsTemplate={QueryOptionsTemplate} infinite={undefined} suspense={suspense} + query={query} hookName={importNames.querySuspense[framework].hookName} resultType={importNames.querySuspense[framework].resultType} optionsType={importNames.querySuspense[framework].optionsType} diff --git a/packages/swagger-tanstack-query/src/components/QueryKey.tsx b/packages/swagger-tanstack-query/src/components/QueryKey.tsx index 566a348a3..1a7bea201 100644 --- a/packages/swagger-tanstack-query/src/components/QueryKey.tsx +++ b/packages/swagger-tanstack-query/src/components/QueryKey.tsx @@ -135,6 +135,7 @@ const defaultTemplates = { type Props = { name: string typeName: string + keysFn?: (keys: unknown[]) => unknown[] factory: { name: string } @@ -144,7 +145,7 @@ type Props = { Template?: React.ComponentType } -export function QueryKey({ name, typeName, factory, Template = defaultTemplates.react }: Props): ReactNode { +export function QueryKey({ name, typeName, factory, keysFn = (keys) => keys, Template = defaultTemplates.react }: Props): ReactNode { const schemas = useSchemas() const operation = useOperation() const path = new URLPath(operation.path) @@ -171,7 +172,7 @@ export function QueryKey({ name, typeName, factory, Template = defaultTemplates. withQueryParams ? `...(params ? [params] : [])` : undefined, ].filter(Boolean) - return