Skip to content

Commit c123f05

Browse files
committed
feat(sdk): update validator config types
1 parent aea5dbd commit c123f05

File tree

127 files changed

+1180
-847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1180
-847
lines changed

docs/openapi-ts/plugins/custom.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export type { Config } from './types';
3131
::: code-group
3232

3333
```ts [types.d.ts]
34-
export interface Config {
34+
export type Config = {
3535
/**
3636
* Plugin name. Must be unique.
3737
*/
@@ -48,7 +48,7 @@ export interface Config {
4848
* @default false
4949
*/
5050
myOption?: boolean;
51-
}
51+
};
5252
```
5353

5454
:::
@@ -75,7 +75,6 @@ export const defaultConfig: Plugin.Config<Config> = {
7575
},
7676
dependencies: ['@hey-api/typescript'],
7777
handler,
78-
handlerLegacy: () => {},
7978
name: 'my-plugin',
8079
output: 'my-plugin',
8180
};

packages/custom-client/src/plugin.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
export type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: '@hey-api/custom-client';
15-
}
15+
};
1616

1717
export const defaultConfig: Plugin.Config<Config> = {
1818
...clientDefaultMeta,
@@ -21,7 +21,6 @@ export const defaultConfig: Plugin.Config<Config> = {
2121
bundle: false,
2222
},
2323
handler: clientPluginHandler,
24-
handlerLegacy: () => {},
2524
name: '@hey-api/custom-client',
2625
};
2726

packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/base-url-false/client/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: string;
1515
}
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type MyClientPlugin = Plugin.Types<Config>;
18+
19+
export const defaultConfig: Plugin.Config<MyClientPlugin> = {
1820
...clientDefaultMeta,
1921
config: clientDefaultConfig,
20-
handler: clientPluginHandler,
22+
handler: clientPluginHandler as Plugin.Handler<MyClientPlugin>,
2123
name: __filename,
2224
};
2325

packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/base-url-number/client/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: string;
1515
}
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type MyClientPlugin = Plugin.Types<Config>;
18+
19+
export const defaultConfig: Plugin.Config<MyClientPlugin> = {
1820
...clientDefaultMeta,
1921
config: clientDefaultConfig,
20-
handler: clientPluginHandler,
22+
handler: clientPluginHandler as Plugin.Handler<MyClientPlugin>,
2123
name: __filename,
2224
};
2325

packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/base-url-strict/client/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: string;
1515
}
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type MyClientPlugin = Plugin.Types<Config>;
18+
19+
export const defaultConfig: Plugin.Config<MyClientPlugin> = {
1820
...clientDefaultMeta,
1921
config: clientDefaultConfig,
20-
handler: clientPluginHandler,
22+
handler: clientPluginHandler as Plugin.Handler<MyClientPlugin>,
2123
name: __filename,
2224
};
2325

packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/base-url-string/client/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: string;
1515
}
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type MyClientPlugin = Plugin.Types<Config>;
18+
19+
export const defaultConfig: Plugin.Config<MyClientPlugin> = {
1820
...clientDefaultMeta,
1921
config: clientDefaultConfig,
20-
handler: clientPluginHandler,
22+
handler: clientPluginHandler as Plugin.Handler<MyClientPlugin>,
2123
name: __filename,
2224
};
2325

packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/bundle/client/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: string;
1515
}
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type MyClientPlugin = Plugin.Types<Config>;
18+
19+
export const defaultConfig: Plugin.Config<MyClientPlugin> = {
1820
...clientDefaultMeta,
1921
config: clientDefaultConfig,
20-
handler: clientPluginHandler,
22+
handler: clientPluginHandler as Plugin.Handler<MyClientPlugin>,
2123
name: __filename,
2224
};
2325

packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/default/client/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: string;
1515
}
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type MyClientPlugin = Plugin.Types<Config>;
18+
19+
export const defaultConfig: Plugin.Config<MyClientPlugin> = {
1820
...clientDefaultMeta,
1921
config: clientDefaultConfig,
20-
handler: clientPluginHandler,
22+
handler: clientPluginHandler as Plugin.Handler<MyClientPlugin>,
2123
name: __filename,
2224
};
2325

packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/sdk-client-optional/client/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: string;
1515
}
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type MyClientPlugin = Plugin.Types<Config>;
18+
19+
export const defaultConfig: Plugin.Config<MyClientPlugin> = {
1820
...clientDefaultMeta,
1921
config: clientDefaultConfig,
20-
handler: clientPluginHandler,
22+
handler: clientPluginHandler as Plugin.Handler<MyClientPlugin>,
2123
name: __filename,
2224
};
2325

packages/openapi-ts-tests/test/__snapshots__/3.1.x/clients/my-client/sdk-client-required/client/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import {
77
type Plugin,
88
} from '@hey-api/openapi-ts';
99

10-
export interface Config extends Client.Config {
10+
type Config = Client.Config & {
1111
/**
1212
* Plugin name. Must be unique.
1313
*/
1414
name: string;
1515
}
1616

17-
export const defaultConfig: Plugin.Config<Config> = {
17+
export type MyClientPlugin = Plugin.Types<Config>;
18+
19+
export const defaultConfig: Plugin.Config<MyClientPlugin> = {
1820
...clientDefaultMeta,
1921
config: clientDefaultConfig,
20-
handler: clientPluginHandler,
22+
handler: clientPluginHandler as Plugin.Handler<MyClientPlugin>,
2123
name: __filename,
2224
};
2325

0 commit comments

Comments
 (0)