···11+---
22+'@hey-api/openapi-ts': minor
33+---
44+55+feat: added `client.baseUrl` option
66+77+### Added `client.baseUrl` option
88+99+You can use this option to configure the default base URL for the generated client. By default, we will attempt to resolve the first defined server or infer the base URL from the input path. If you'd like to preserve the previous behavior, set `baseUrl` to `false`.
1010+1111+```js
1212+export default {
1313+ input: 'path/to/openapi.json',
1414+ output: 'src/client',
1515+ plugins: [{
1616+ baseUrl: false, // [!code ++]
1717+ name: '@hey-api/client-fetch',
1818+ }],
1919+};
2020+```
+14-4
.changeset/unlucky-moles-dance.md
···11---
22-'@hey-api/client-axios': patch
33-'@hey-api/client-fetch': patch
44-'@hey-api/client-next': patch
55-'@hey-api/client-nuxt': patch
22+'@hey-api/client-axios': minor
33+'@hey-api/client-fetch': minor
44+'@hey-api/client-next': minor
55+'@hey-api/client-nuxt': minor
66+'@hey-api/openapi-ts': minor
67---
7889fix: make createConfig, CreateClientConfig, and Config accept ClientOptions generic
1010+1111+### Added `ClientOptions` interface
1212+1313+The `Config` interface now accepts an optional generic extending `ClientOptions` instead of `boolean` type `ThrowOnError`.
1414+1515+```ts
1616+type Foo = Config<false> // [!code --]
1717+type Foo = Config<{ throwOnError: false }> // [!code ++]
1818+```
+1-1
docs/openapi-ts/clients/axios.md
···106106::: code-group
107107108108```ts [hey-api.ts]
109109-import type { CreateClientConfig } from '@hey-api/client-axios';
109109+import type { CreateClientConfig } from './client/client.gen';
110110111111export const createClientConfig: CreateClientConfig = (config) => ({
112112 ...config,
+1-1
docs/openapi-ts/clients/fetch.md
···106106::: code-group
107107108108```ts [hey-api.ts]
109109-import type { CreateClientConfig } from '@hey-api/client-fetch';
109109+import type { CreateClientConfig } from './client/client.gen';
110110111111export const createClientConfig: CreateClientConfig = (config) => ({
112112 ...config,
+1-1
docs/openapi-ts/clients/next-js.md
···102102::: code-group
103103104104```ts [hey-api.ts]
105105-import type { CreateClientConfig } from '@hey-api/client-next';
105105+import type { CreateClientConfig } from './client/client.gen';
106106107107export const createClientConfig: CreateClientConfig = (config) => ({
108108 ...config,
+1-1
docs/openapi-ts/clients/nuxt.md
···102102::: code-group
103103104104```ts [hey-api.ts]
105105-import type { CreateClientConfig } from '@hey-api/client-nuxt';
105105+import type { CreateClientConfig } from './client/client.gen';
106106107107export const createClientConfig: CreateClientConfig = (config) => ({
108108 ...config,
+28
docs/openapi-ts/migrating.md
···27272828This config option is deprecated and will be removed.
29293030+## v0.64.0
3131+3232+### Added `ClientOptions` interface
3333+3434+The `Config` interface now accepts an optional generic extending `ClientOptions` instead of `boolean` type `ThrowOnError`.
3535+3636+```ts
3737+type Foo = Config<false>; // [!code --]
3838+type Foo = Config<{ throwOnError: false }>; // [!code ++]
3939+```
4040+4141+### Added `client.baseUrl` option
4242+4343+You can use this option to configure the default base URL for the generated client. By default, we will attempt to resolve the first defined server or infer the base URL from the input path. If you'd like to preserve the previous behavior, set `baseUrl` to `false`.
4444+4545+```js
4646+export default {
4747+ input: 'path/to/openapi.json',
4848+ output: 'src/client',
4949+ plugins: [
5050+ {
5151+ baseUrl: false, // [!code ++]
5252+ name: '@hey-api/client-fetch',
5353+ },
5454+ ],
5555+};
5656+```
5757+3058## v0.63.0
31593260### Client plugins
+23-2
examples/openapi-ts-next/src/client/client.gen.ts
···11// This file is auto-generated by @hey-api/openapi-ts
2233-import { createClient, createConfig } from '@hey-api/client-next';
33+import {
44+ type ClientOptions as DefaultClientOptions,
55+ type Config,
66+ createClient,
77+ createConfig,
88+} from '@hey-api/client-next';
49510import { createClientConfig } from '../hey-api';
1111+import type { ClientOptions } from './types.gen';
61277-export const client = createClient(createClientConfig(createConfig()));
1313+/**
1414+ * The `createClientConfig()` function will be called on client initialization
1515+ * and the returned object will become the client's initial configuration.
1616+ *
1717+ * You may want to initialize your client this way instead of calling
1818+ * `setConfig()`. This is useful for example if you're using Next.js
1919+ * to ensure your client always has the correct values.
2020+ */
2121+export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =
2222+ (
2323+ override?: Config<DefaultClientOptions & T>,
2424+ ) => Config<Required<DefaultClientOptions> & T>;
2525+2626+export const client = createClient(
2727+ createClientConfig(createConfig<ClientOptions>()),
2828+);