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