diff --git a/docs/plugins/swagger-client/index.md b/docs/plugins/swagger-client/index.md
index 5683c9db9..b20bf03eb 100644
--- a/docs/plugins/swagger-client/index.md
+++ b/docs/plugins/swagger-client/index.md
@@ -132,19 +132,6 @@ export default defineConfig({
:::
-### client
-
-Path to the client that will be used to do the API calls.
-Relative to the root
-
-::: info
-
-Type: `string`
-Default: `'@kubb/swagger-client/client'`
-
-Deprecated. Use `clientImportPath` instead. It will be skipped if `clientImportPath` is provided.
-:::
-
### clientImportPath
Path to the client import path that will be used to do the API calls.
diff --git a/docs/plugins/swagger-swr.md b/docs/plugins/swagger-swr.md
index b3f0041d9..90511e89a 100644
--- a/docs/plugins/swagger-swr.md
+++ b/docs/plugins/swagger-swr.md
@@ -137,19 +137,6 @@ export default defineConfig({
:::
-### client
-
-Path to the client that will be used to do the API calls.
-Relative to the root
-
-::: info
-
-Type: `string`
-Default: `'@kubb/swagger-client/client'`
-
-Deprecated. Use `clientImportPath` instead. It will be skipped if `clientImportPath` is provided.
-:::
-
### clientImportPath
Path to the client import path that will be used to do the API calls.
diff --git a/docs/plugins/swagger-tanstack-query.md b/docs/plugins/swagger-tanstack-query.md
index 62adf3301..2083af5dc 100644
--- a/docs/plugins/swagger-tanstack-query.md
+++ b/docs/plugins/swagger-tanstack-query.md
@@ -145,20 +145,6 @@ export default defineConfig({
:::
-### client
-
-Path to the client that will be used to do the API calls.
-Relative to the root
-
-::: info
-
-Type: `string`
-Default: `'@kubb/swagger-client/client'`
-
-Deprecated. Use `clientImportPath` instead. It will be skipped if `clientImportPath` is provided.
-
-:::
-
### clientImportPath
Path to the client import path that will be used to do the API calls.
diff --git a/packages/swagger-client/src/components/Client.tsx b/packages/swagger-client/src/components/Client.tsx
index 578c34014..30aca5883 100644
--- a/packages/swagger-client/src/components/Client.tsx
+++ b/packages/swagger-client/src/components/Client.tsx
@@ -1,8 +1,6 @@
-import path from 'node:path'
-
-import { FunctionParams, getRelativePath, transformers } from '@kubb/core/utils'
+import { FunctionParams, transformers } from '@kubb/core/utils'
import { URLPath } from '@kubb/core/utils'
-import { File, Function, usePlugin, usePluginManager } from '@kubb/react'
+import { File, Function, usePlugin } from '@kubb/react'
import { useOperation, useResolve, useSchemas } from '@kubb/swagger/hooks'
import { getASTParams, getComments } from '@kubb/swagger/utils'
import { useResolve as useResolveType } from '@kubb/swagger-ts/hooks'
@@ -167,16 +165,13 @@ type FileProps = {
Client.File = function({ templates = defaultTemplates }: FileProps): ReactNode {
const { key: pluginKey, options } = usePlugin()
- const { config } = usePluginManager()
const schemas = useSchemas()
const operation = useOperation()
const file = useResolve({ pluginKey, type: 'file' })
const fileType = useResolveType({ type: 'file' })
- const { clientImportPath, client } = options
- const root = path.resolve(config.root, config.output.path)
- const clientPath = client ? path.resolve(root, 'client.ts') : undefined
- const resolvedClientPath = clientImportPath ? clientImportPath : clientPath ? getRelativePath(file.path, clientPath) : '@kubb/swagger-client/client'
+ const { clientImportPath } = options
+ const resolvedClientPath = clientImportPath ? clientImportPath : '@kubb/swagger-client/client'
const Template = templates.default
diff --git a/packages/swagger-client/src/plugin.ts b/packages/swagger-client/src/plugin.ts
index 10e2d9ac1..fe5d09f8e 100644
--- a/packages/swagger-client/src/plugin.ts
+++ b/packages/swagger-client/src/plugin.ts
@@ -23,7 +23,6 @@ export const definePlugin = createPlugin((options) => {
skipBy = [],
overrideBy = [],
transformers = {},
- client,
clientImportPath,
dataReturnType = 'data',
pathParamsType = 'inline',
@@ -36,7 +35,6 @@ export const definePlugin = createPlugin((options) => {
name: pluginName,
options: {
dataReturnType,
- client,
clientImportPath,
pathParamsType,
},
@@ -121,34 +119,6 @@ export const definePlugin = createPlugin((options) => {
await this.addFile(...rootFiles)
}
- // Copy `client.ts` file only when the 'client' option is provided.
- if (client) {
- const packageManager = new PackageManager(process.cwd())
-
- const clientPath = path.resolve(root, 'client.ts')
- const originalClientPath: KubbFile.OptionalPath = options.client
- ? path.resolve(this.config.root, options.client)
- : packageManager.getLocation('@kubb/swagger-client/ts-client')
-
- if (!originalClientPath) {
- throw new Error(
- `Cannot find the 'client.ts' file, or 'client' is not set in the options or '@kubb/swagger-client' is not included in your dependencies`,
- )
- }
-
- const baseURL = await swaggerPlugin.api.getBaseURL()
-
- await this.addFile({
- baseName: 'client.ts',
- path: clientPath,
- source: await read(originalClientPath),
- env: {
- AXIOS_BASE: baseURL,
- AXIOS_HEADERS: JSON.stringify({}),
- },
- })
- }
-
await this.fileManager.addIndexes({ root, extName: '.ts', meta: { pluginKey: this.plugin.key } })
},
}
diff --git a/packages/swagger-client/src/types.ts b/packages/swagger-client/src/types.ts
index b0b335bab..2018a8ba8 100644
--- a/packages/swagger-client/src/types.ts
+++ b/packages/swagger-client/src/types.ts
@@ -37,13 +37,6 @@ export type Options = {
* Array containing overrideBy paramaters to override `options` based on tags/operations/methods/paths.
*/
overrideBy?: Array>
- /**
- * Path to the client that will be used to do the API calls.
- * Relative to the root.
- * @default '@kubb/swagger-client/client'
- * @deprecated Use `clientImportPath` instead. It will be skipped if `clientImportPath` is provided.
- */
- client?: string
/**
* Path to the client import path that will be used to do the API calls.
* It will be used as `import client from '${clientImportPath}'`.
@@ -88,7 +81,6 @@ type ResolvedOptions = {
clientImportPath?: Options['clientImportPath']
dataReturnType: NonNullable
pathParamsType: NonNullable
- client?: Options['client']
}
export type FileMeta = {
diff --git a/packages/swagger-swr/src/generators/OperationGenerator.ts b/packages/swagger-swr/src/generators/OperationGenerator.ts
index cee4b4a71..6a1e42577 100644
--- a/packages/swagger-swr/src/generators/OperationGenerator.ts
+++ b/packages/swagger-swr/src/generators/OperationGenerator.ts
@@ -9,7 +9,6 @@ import type { Operation, OperationSchema, OperationSchemas, Resolver } from '@ku
import type { FileMeta, PluginOptions } from '../types.ts'
type Options = {
- clientPath?: NonNullable
clientImportPath?: NonNullable
dataReturnType: NonNullable
}
@@ -68,15 +67,13 @@ export class OperationGenerator extends Generator {
}
async get(operation: Operation, schemas: OperationSchemas, options: Options): Promise | null> {
- const { clientPath, dataReturnType } = options
+ const { dataReturnType } = options
const { pluginManager, oas, plugin } = this.context
const hook = this.resolve(operation)
const type = this.resolveType(operation)
- const clientImportPath = this.options.clientImportPath
- ? this.options.clientImportPath
- : clientPath
- ? getRelativePath(hook.path, clientPath)
+ const clientImportPath = options.clientImportPath
+ ? options.clientImportPath
: '@kubb/swagger-client/client'
let errors: Resolver[] = []
@@ -137,15 +134,13 @@ export class OperationGenerator extends Generator {
}
async post(operation: Operation, schemas: OperationSchemas, options: Options): Promise | null> {
- const { clientPath, dataReturnType } = options
+ const { dataReturnType } = options
const { pluginManager, oas, plugin } = this.context
const hook = this.resolve(operation)
const type = this.resolveType(operation)
- const clientImportPath = this.options.clientImportPath
- ? this.options.clientImportPath
- : clientPath
- ? getRelativePath(hook.path, clientPath)
+ const clientImportPath = options.clientImportPath
+ ? options.clientImportPath
: '@kubb/swagger-client/client'
let errors: Resolver[] = []
diff --git a/packages/swagger-swr/src/plugin.ts b/packages/swagger-swr/src/plugin.ts
index 41240f6ef..f96658777 100644
--- a/packages/swagger-swr/src/plugin.ts
+++ b/packages/swagger-swr/src/plugin.ts
@@ -9,7 +9,7 @@ import { camelCase, camelCaseTransformMerge } from 'change-case'
import { OperationGenerator } from './generators/index.ts'
-import type { KubbFile, KubbPlugin } from '@kubb/core'
+import type { KubbPlugin } from '@kubb/core'
import type { PluginOptions as SwaggerPluginOptions } from '@kubb/swagger'
import type { PluginOptions } from './types.ts'
@@ -60,13 +60,10 @@ export const definePlugin = createPlugin((options) => {
const oas = await swaggerPlugin.api.getOas()
- const clientPath: KubbFile.OptionalPath = options.client ? path.resolve(this.config.root, options.client) : undefined
-
const operationGenerator = new OperationGenerator(
{
dataReturnType,
clientImportPath: options.clientImportPath,
- clientPath,
},
{
oas,
diff --git a/packages/swagger-swr/src/types.ts b/packages/swagger-swr/src/types.ts
index 22a9fe92f..72808e555 100644
--- a/packages/swagger-swr/src/types.ts
+++ b/packages/swagger-swr/src/types.ts
@@ -37,13 +37,6 @@ export type Options = {
* Array containing overrideBy paramaters to override `options` based on tags/operations/methods/paths.
*/
overrideBy?: Array>
- /**
- * Path to the client that will be used to do the API calls.
- * Relative to the root.
- * @default '@kubb/swagger-client/client'
- * @deprecated Use `clientImportPath` instead. It will be skipped if `clientImportPath` is provided.
- */
- client?: string
/**
* Path to the client import path that will be used to do the API calls.
* It will be used as `import client from '${clientImportPath}'`.
diff --git a/packages/swagger-tanstack-query/src/components/Mutation.tsx b/packages/swagger-tanstack-query/src/components/Mutation.tsx
index 5ba109abd..44611f279 100644
--- a/packages/swagger-tanstack-query/src/components/Mutation.tsx
+++ b/packages/swagger-tanstack-query/src/components/Mutation.tsx
@@ -344,16 +344,13 @@ type FileProps = {
Mutation.File = function({ templates = defaultTemplates, imports = MutationImports.templates }: FileProps): ReactNode {
const { key: pluginKey, options } = usePlugin()
- const pluginManager = usePluginManager()
const schemas = useSchemas()
const operation = useOperation()
const file = useResolve({ pluginKey, type: 'file' })
const fileType = useResolveType({ type: 'file' })
- const { clientImportPath, client, templatesPath, framework } = options
- const root = path.resolve(pluginManager.config.root, pluginManager.config.output.path)
- const clientPath = client ? path.resolve(root, 'client.ts') : undefined
- const resolvedClientPath = clientImportPath ? clientImportPath : clientPath ? getRelativePath(file.path, clientPath) : '@kubb/swagger-client/client'
+ const { clientImportPath, templatesPath, framework } = options
+ const resolvedClientPath = clientImportPath ? clientImportPath : '@kubb/swagger-client/client'
const importNames = getImportNames()
const Template = templates[framework]
diff --git a/packages/swagger-tanstack-query/src/components/Query.tsx b/packages/swagger-tanstack-query/src/components/Query.tsx
index 70c706b3d..24fa8ee95 100644
--- a/packages/swagger-tanstack-query/src/components/Query.tsx
+++ b/packages/swagger-tanstack-query/src/components/Query.tsx
@@ -1,8 +1,8 @@
import path from 'node:path'
import { PackageManager } from '@kubb/core'
-import { FunctionParams, getRelativePath, URLPath } from '@kubb/core/utils'
-import { File, Function, Type, usePlugin, usePluginManager } from '@kubb/react'
+import { FunctionParams, URLPath } from '@kubb/core/utils'
+import { File, Function, Type, usePlugin } from '@kubb/react'
import { useOperation, useResolve, useSchemas } from '@kubb/swagger/hooks'
import { getASTParams, getComments, getParams } from '@kubb/swagger/utils'
import { useResolve as useResolveType } from '@kubb/swagger-ts/hooks'
@@ -393,16 +393,13 @@ type FileProps = {
Query.File = function({ templates = defaultTemplates, imports = QueryImports.templates }: FileProps): ReactNode {
const { key: pluginKey, options } = usePlugin()
- const pluginManager = usePluginManager()
const schemas = useSchemas()
const operation = useOperation()
const file = useResolve({ pluginKey, type: 'file' })
const fileType = useResolveType({ type: 'file' })
- const { clientImportPath, client, templatesPath, framework, infinite } = options
- const root = path.resolve(pluginManager.config.root, pluginManager.config.output.path)
- const clientPath = client ? path.resolve(root, 'client.ts') : undefined
- const resolvedClientPath = clientImportPath ? clientImportPath : clientPath ? getRelativePath(file.path, clientPath) : '@kubb/swagger-client/client'
+ const { clientImportPath, templatesPath, framework, infinite } = options
+ const resolvedClientPath = clientImportPath ? clientImportPath : '@kubb/swagger-client/client'
const importNames = getImportNames()
const Template = templates[framework]
diff --git a/packages/swagger-tanstack-query/src/plugin.ts b/packages/swagger-tanstack-query/src/plugin.ts
index 33d811807..3791e588d 100644
--- a/packages/swagger-tanstack-query/src/plugin.ts
+++ b/packages/swagger-tanstack-query/src/plugin.ts
@@ -24,7 +24,6 @@ export const definePlugin = createPlugin((options) => {
skipBy = [],
overrideBy = [],
framework = 'react',
- client,
clientImportPath,
infinite,
transformers = {},
@@ -38,7 +37,6 @@ export const definePlugin = createPlugin((options) => {
options: {
framework,
clientImportPath,
- client,
dataReturnType,
infinite: infinite
? {
diff --git a/packages/swagger-tanstack-query/src/types.ts b/packages/swagger-tanstack-query/src/types.ts
index 94794f35b..b9f34d365 100644
--- a/packages/swagger-tanstack-query/src/types.ts
+++ b/packages/swagger-tanstack-query/src/types.ts
@@ -43,13 +43,6 @@ export type Options = {
*/
exportAs?: string
}
- /**
- * Path to the client that will be used to do the API calls.
- * Relative to the root.
- * @default '@kubb/swagger-client/client'
- * @deprecated Use `clientImportPath` instead. It will be skipped if `clientImportPath` is provided.
- */
- client?: string
/**
* Path to the client import path that will be used to do the API calls.
* It will be used as `import client from '${clientImportPath}'`.
@@ -110,7 +103,6 @@ export type Framework = 'react' | 'solid' | 'svelte' | 'vue'
type ResolvedOptions = {
framework: NonNullable
- client?: Options['client']
clientImportPath?: PluginOptions['options']['clientImportPath']
dataReturnType: NonNullable
/**